Evotec

Project

PSWriteOffice

PSWriteOffice is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 144
Forks 12
Open issues 16
PowerShell Gallery downloads 150,904
Release v0.2.0
Language: C# Updated: 2026-04-06

API Reference

Cmdlet

Add-OfficeExcelConditionalColorScale

Namespace PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Object

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> [-PassThru] -Range <String> -StartColor <String> [<CommonParameters>]
#
Parameter set: Context

Parameters

EndColor String requiredposition: 2pipeline: False
End color in hex (#RRGGBB or FFRRGGBB).
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the range after applying the format.
Range String requiredposition: 0pipeline: False
A1 range to format.
StartColor String requiredposition: 1pipeline: False
Start color in hex (#RRGGBB or FFRRGGBB).

Outputs

System.Object

Add-OfficeExcelConditionalColorScale -Document <ExcelDocument> -EndColor <String> [-PassThru] -Range <String> [-Sheet <String>] [-SheetIndex <Nullable`1>] -StartColor <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 in hex (#RRGGBB or FFRRGGBB).
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the range after applying the format.
Range String requiredposition: 0pipeline: False
A1 range to format.
Sheet String optionalposition: namedpipeline: False
Worksheet name when using Document.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) when using Document.
StartColor String requiredposition: 1pipeline: False
Start color in hex (#RRGGBB or FFRRGGBB).

Outputs

System.Object