Cmdlet
Clear-OfficeExcelConditionalFormatting
Clears conditional formatting rules from one or more Excel worksheets.
Syntax
Clear-OfficeExcelConditionalFormatting [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-Range <String>] [-Sheet <String>] [-SheetIndex <Int32>] [-TableName <String>] [<CommonParameters>]#Parameter set:
ContextClear-OfficeExcelConditionalFormatting [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-Path] <String> [-Range <String>] [-Sheet <String>] [-SheetIndex <Int32>] [-TableName <String>] [<CommonParameters>]#Parameter set:
PathClear-OfficeExcelConditionalFormatting -Document <ExcelDocument> [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-Range <String>] [-Sheet <String>] [-SheetIndex <Int32>] [-TableName <String>] [<CommonParameters>]#Parameter set:
DocumentExamples
Clear stale rules from a target range.
Clear-OfficeExcelConditionalFormatting -Path .\Report.xlsx -Sheet Data -HeaderName Status -TableName ServiceHealth -Confirm:$false
Get-OfficeExcelConditionalFormatting -Path .\Report.xlsx -Sheet Data |
Where-Object Range -like '*Status*'Removes conditional formatting metadata that overlaps the target range and saves the workbook.
Parameters
- -HeaderName String
- Header or table column name used to resolve the range to clear.
- -HeaderRow Int32
- Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
- -IncludeHeader SwitchParameter
- Include the header cell in the resolved range.
- -PassThru SwitchParameter
- Emit the object created or changed by the command.
- -Range String
- Optional A1 range to clear. When omitted, all conditional formatting on the selected sheet is cleared.
- -Sheet String
- Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
- -SheetIndex Int32
- Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
- -TableName String
- Optional table name for header-based range resolution.
- -Path String
- Workbook path to update.
- -Document ExcelDocument
- 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.