Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
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

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.