Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Clear-OfficeExcelConditionalFormatting

Aliases: ExcelConditionalFormattingClear
Module PSWriteOffice
Aliases
ExcelConditionalFormattingClear
Inputs
OfficeIMO.Excel.ExcelDocument

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: Context
Clear-OfficeExcelConditionalFormatting [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-Path] <String> [-Range <String>] [-Sheet <String>] [-SheetIndex <Int32>] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Path
Clear-OfficeExcelConditionalFormatting -Document <ExcelDocument> [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-Range <String>] [-Sheet <String>] [-SheetIndex <Int32>] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Document

Examples

Authored help example

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 optionalaliases: ColumnName
Header or table column name used to resolve the range to clear.
-HeaderRow Int32 optional
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
-IncludeHeader SwitchParameter optional
Include the header cell in the resolved range.
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Range String optional
Optional A1 range to clear. When omitted, all conditional formatting on the selected sheet is cleared.
-Sheet String optional
Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
-SheetIndex Int32 optional
Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
-TableName String optional
Optional table name for header-based range resolution.
-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.