# Add-OfficeExcelConditionalColorScale

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

Project

PSWriteOffice

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

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **4**

Total downloads **5,250,223**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: ExcelConditionalColorScale

**Module**

`PSWriteOffice`

**Aliases**

`ExcelConditionalColorScale`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[AddOfficeExcelConditionalColorScaleCommand.cs:18](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/AddOfficeExcelConditionalColorScaleCommand.cs#L18) 

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

## Syntax

```
Add-OfficeExcelConditionalColorScale
[-EndColor] <String>
[-HeaderName <String>]
[-HeaderRow <Int32>]
[-IncludeHeader]
[-PassThru]
[-PivotTableName <String>]
[-PivotWholeTable]
[[-Range] <String>]
[-StartColor] <String>
[-TableName <String>]
[<CommonParameters>]
```

[#](#method-add-officeexcelconditionalcolorscale-string-string-int32-switchparameter-switchparameter-string-switchparameter-string-string-string)

Parameter set: `Context`

```
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>]
```

[#](#method-add-officeexcelconditionalcolorscale-exceldocument-string-string-int32-switchparameter-switchparameter-string-switchparameter-string-string-int32-string-string)

Parameter set: `Document`

## Examples

### Apply a red-to-green color scale.

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

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

## Parameters

**-EndColor String requiredposition: 2**

End color. Named colors and hexadecimal values are accepted.

**-HeaderName String optionalaliases: ColumnName**

Header or table column name used to resolve the target range.

**-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 range after applying the format.

**-PivotTableName String optional**

Pivot table name used to resolve the target range.

**-PivotWholeTable SwitchParameter optional**

Use the full pivot output range instead of the default data body range.

**-Range String optionalposition: 0**

A1 range to format.

**-StartColor String requiredposition: 1**

Start color. Named colors and hexadecimal values are accepted.

**-TableName String optional**

Optional table name for header-based range resolution.

**-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document**

Workbook to operate on outside the DSL context.

**-Sheet String optionalsets: Document**

Worksheet name when using Document.

**-SheetIndex Int32 optionalsets: Document**

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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:284FFDFBDE1F19F44E081667766B35AB70A8D6D29408D7634A4063EC00E56E24 -->
