# Add-OfficeExcelReportLegend

Adds a legend table to the current Excel report sheet.

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 **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: ExcelReportLegend

**Module**

`PSWriteOffice`

**Aliases**

`ExcelReportLegend`

**Inputs**

`None`

**Source**

[OfficeExcelReportBlockCommands.cs:219](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/OfficeExcelReportBlockCommands.cs#L219) 

Adds a legend table to the current Excel report sheet.

## Syntax

```
Add-OfficeExcelReportLegend
[-CaseSensitive]
[-FirstColumnFillByValue <Hashtable>]
-Header <String[]>
[-HeaderFillColor <String>]
-InputObject <Object[]>
[-PassThru]
[[-Title] <String>]
[<CommonParameters>]
```

[#](#method-add-officeexcelreportlegend-switchparameter-hashtable-string-string-object-switchparameter-string)

Parameter set: `All Parameter Sets`

## Examples

### Add a status legend with colored first-column values.

```powershell
$legendRows = @(
    [pscustomobject]@{ Status = 'Ready'; Meaning = 'Validated and ready' }
    [pscustomobject]@{ Status = 'Review'; Meaning = 'Needs owner review' }
)
New-OfficeExcel -Path .\Operations.xlsx {
    Add-OfficeExcelReportSheet -Name Summary {
        Add-OfficeExcelReportLegend -Title 'Status legend' -Header Status, Meaning -InputObject $legendRows -FirstColumnFillByValue @{ Ready = '#d9f7be'; Review = '#fff7e6' }
    }
}
```

Renders legend rows and applies optional fill colors keyed by the first column.

## Parameters

**-CaseSensitive SwitchParameter optional**

Use case-sensitive matching for first-column fill values.

**-FirstColumnFillByValue Hashtable optional**

Optional first-column fill colors keyed by first-column value.

**-Header String[] requiredaliases: Headers**

Column headers.

**-HeaderFillColor String optional**

Optional header fill color.

**-InputObject Object[] requiredaliases: Rows**

Rows. Each row may be an array, enumerable, hashtable, or object.

**-PassThru SwitchParameter optional**

Emit the object created or changed by the command.

**-Title String optionalposition: 0**

Optional legend title.

## 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:47057DC9D4E79539A6B0EFCA146E6C879F38B9876451652A2AE0AC243266047A -->
