Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

Add-OfficeExcelConditionalColorScale

Aliases: ExcelConditionalColorScale
Namespace PSWriteOffice
Aliases
ExcelConditionalColorScale
Inputs
OfficeIMO.Excel.ExcelDocument

Adds a two-color scale conditional format to a range.

Remarks

Adds a two-color scale conditional format to a range.

Examples

Authored help example

Apply a red-to-green color scale.

PS>


ExcelSheet 'Data' { Add-OfficeExcelConditionalColorScale -Range 'B2:B50' -StartColor '#FF0000' -EndColor '#00FF00' }
        

Applies a red-to-green scale to column B.

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.

Syntax

Add-OfficeExcelConditionalColorScale -EndColor <String> [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-PivotTableName <String>] [-PivotWholeTable] [-Range <String>] -StartColor <String> [-TableName <String>] [<CommonParameters>]
#
Parameter set: Context

Parameters

EndColor String requiredposition: 2pipeline: False
End color. Named colors and hexadecimal values are accepted.
HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the target range.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the range after applying the format.
PivotTableName String optionalposition: namedpipeline: False
Pivot table name used to resolve the target range.
PivotWholeTable SwitchParameter optionalposition: namedpipeline: False
Use the full pivot output range instead of the default data body range.
Range String optionalposition: 0pipeline: False
A1 range to format.
StartColor String requiredposition: 1pipeline: False
Start color. Named colors and hexadecimal values are accepted.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.
Add-OfficeExcelConditionalColorScale -Document <ExcelDocument> -EndColor <String> [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-PivotTableName <String>] [-PivotWholeTable] [-Range <String>] [-Sheet <String>] [-SheetIndex <Int32>] -StartColor <String> [-TableName <String>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to operate on outside the DSL context.
EndColor String requiredposition: 2pipeline: False
End color. Named colors and hexadecimal values are accepted.
HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the target range.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the range after applying the format.
PivotTableName String optionalposition: namedpipeline: False
Pivot table name used to resolve the target range.
PivotWholeTable SwitchParameter optionalposition: namedpipeline: False
Use the full pivot output range instead of the default data body range.
Range String optionalposition: 0pipeline: False
A1 range to format.
Sheet String optionalposition: namedpipeline: False
Worksheet name when using Document.
SheetIndex Int32 optionalposition: namedpipeline: False
Worksheet index (0-based) when using Document.
StartColor String requiredposition: 1pipeline: False
Start color. Named colors and hexadecimal values are accepted.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.