Cmdlet
Protect-OfficeExcelSheet
Protects the current worksheet.
Syntax
Protect-OfficeExcelSheet
[-AllowAutoFilter <Boolean>]
[-AllowDeleteColumns <Boolean>]
[-AllowDeleteRows <Boolean>]
[-AllowFormatCells <Boolean>]
[-AllowFormatColumns <Boolean>]
[-AllowFormatRows <Boolean>]
[-AllowInsertColumns <Boolean>]
[-AllowInsertHyperlinks <Boolean>]
[-AllowInsertRows <Boolean>]
[-AllowPivotTables <Boolean>]
[-AllowSelectLockedCells <Boolean>]
[-AllowSelectUnlockedCells <Boolean>]
[-AllowSort <Boolean>]
[-AllowTableEditing]
[-PassThru]
[<CommonParameters>]#Parameter set:
ContextProtect-OfficeExcelSheet
[-AllowAutoFilter <Boolean>]
[-AllowDeleteColumns <Boolean>]
[-AllowDeleteRows <Boolean>]
[-AllowFormatCells <Boolean>]
[-AllowFormatColumns <Boolean>]
[-AllowFormatRows <Boolean>]
[-AllowInsertColumns <Boolean>]
[-AllowInsertHyperlinks <Boolean>]
[-AllowInsertRows <Boolean>]
[-AllowPivotTables <Boolean>]
[-AllowSelectLockedCells <Boolean>]
[-AllowSelectUnlockedCells <Boolean>]
[-AllowSort <Boolean>]
[-AllowTableEditing]
-Document <ExcelDocument>
[-PassThru]
[-Sheet <String>]
[-SheetIndex <Int32>]
[<CommonParameters>]#Parameter set:
DocumentExamples
Protect the active sheet with default options.
ExcelSheet 'Data' { Protect-OfficeExcelSheet }Enables worksheet protection.
Parameters
- -AllowAutoFilter Boolean
- Allow AutoFilter.
- -AllowDeleteColumns Boolean
- Allow deleting columns.
- -AllowDeleteRows Boolean
- Allow deleting rows.
- -AllowFormatCells Boolean
- Allow formatting cells.
- -AllowFormatColumns Boolean
- Allow formatting columns.
- -AllowFormatRows Boolean
- Allow formatting rows.
- -AllowInsertColumns Boolean
- Allow inserting columns.
- -AllowInsertHyperlinks Boolean
- Allow inserting hyperlinks.
- -AllowInsertRows Boolean
- Allow inserting rows.
- -AllowPivotTables Boolean
- Allow PivotTables.
- -AllowSelectLockedCells Boolean
- Allow selecting locked cells.
- -AllowSelectUnlockedCells Boolean
- Allow selecting unlocked cells.
- -AllowSort Boolean
- Allow sorting.
- -AllowTableEditing SwitchParameter
- Allow common protected-table workflows: selecting cells, inserting rows, sorting, and filtering.
- -PassThru SwitchParameter
- Emit the worksheet after protection.
- -Document ExcelDocument
- Workbook to operate on outside the DSL context.
- -Sheet String
- Worksheet name when using Document.
- -SheetIndex Int32
- Worksheet index (0-based) when using Document.
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.