Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Unprotect-OfficeExcelWorkbook

Aliases: ExcelWorkbookUnprotect
Module PSWriteOffice
Aliases
ExcelWorkbookUnprotect
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
OfficeIMO.Excel.ExcelDocument System.IO.FileInfo

Removes workbook structure/window protection metadata.

Syntax

Unprotect-OfficeExcelWorkbook [-PassThru] [<CommonParameters>]
#
Parameter set: Context
Unprotect-OfficeExcelWorkbook [-PassThru] [-Path] <String> [<CommonParameters>]
#
Parameter set: Path
Unprotect-OfficeExcelWorkbook -Document <ExcelDocument> [-PassThru] [<CommonParameters>]
#
Parameter set: Document

Examples

Authored help example

Remove workbook-level protection metadata.

Unprotect-OfficeExcelWorkbook -Path .\Report.xlsx
Test-OfficeExcelWorkbook -Path .\Report.xlsx -SkipOpenXmlValidation |
    Select-Object Passed, ProtectionSummary

Removes workbook structure/window protection metadata and saves the workbook.

Parameters

-PassThru SwitchParameter optional
Emit the workbook after removing protection.
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Workbook path to update.
-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document
Workbook to update outside the DSL context.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.