# Add-OfficeExcelSparkline

Adds sparklines to a worksheet. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

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: ExcelSparkline

**Module**

`PSWriteOffice`

**Aliases**

`ExcelSparkline`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[AddOfficeExcelSparklineCommand.cs:19](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/AddOfficeExcelSparklineCommand.cs#L19) 

Adds sparklines to a worksheet.

## Syntax

```
Add-OfficeExcelSparkline
[-AxisColor <String>]
-DataRange <String>
[-FirstColor <String>]
[-HighColor <String>]
[-LastColor <String>]
-LocationRange <String>
[-LowColor <String>]
[-MarkersColor <String>]
[-NegativeColor <String>]
[-PassThru]
[-SeriesColor <String>]
[-ShowAxis]
[-ShowFirstLast]
[-ShowHighLow]
[-ShowMarkers]
[-ShowNegative]
[-Type <Line|Column|Stacked>]
[<CommonParameters>]
```

[#](#member-404edc473996c86e21a11852)

Parameter set: `Context`

```
Add-OfficeExcelSparkline
[-AxisColor <String>]
-DataRange <String>
-Document <ExcelDocument>
[-FirstColor <String>]
[-HighColor <String>]
[-LastColor <String>]
-LocationRange <String>
[-LowColor <String>]
[-MarkersColor <String>]
[-NegativeColor <String>]
[-PassThru]
[-SeriesColor <String>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-ShowAxis]
[-ShowFirstLast]
[-ShowHighLow]
[-ShowMarkers]
[-ShowNegative]
[-Type <Line|Column|Stacked>]
[<CommonParameters>]
```

[#](#member-fa0943bd01c01b5dcc798035)

Parameter set: `Document`

## Examples

### Add a line sparkline.

```powershell
ExcelSheet 'Data' { Add-OfficeExcelSparkline -DataRange 'B2:M2' -LocationRange 'N2' }
```

Creates a line sparkline in N2 using B2:M2.

## Parameters

**-AxisColor String optional**

Axis color. Named colors and hexadecimal values are accepted.

**-DataRange String required**

A1 range containing source data (e.g., "B2:M2").

**-FirstColor String optional**

First point color. Named colors and hexadecimal values are accepted.

**-HighColor String optional**

High point color. Named colors and hexadecimal values are accepted.

**-LastColor String optional**

Last point color. Named colors and hexadecimal values are accepted.

**-LocationRange String required**

A1 range where the sparklines will be placed (e.g., "N2:N2").

**-LowColor String optional**

Low point color. Named colors and hexadecimal values are accepted.

**-MarkersColor String optional**

Markers color. Named colors and hexadecimal values are accepted.

**-NegativeColor String optional**

Negative point color. Named colors and hexadecimal values are accepted.

**-PassThru SwitchParameter optional**

Emit the worksheet after adding sparklines.

**-SeriesColor String optional**

Series color. Named colors and hexadecimal values are accepted.

**-ShowAxis SwitchParameter optional**

Show axis.

**-ShowFirstLast SwitchParameter optional**

Show first/last points.

**-ShowHighLow SwitchParameter optional**

Show high/low points.

**-ShowMarkers SwitchParameter optional**

Show markers for each point.

**-ShowNegative SwitchParameter optional**

Show negative points.

**-Type ExcelSparklineType optional**

Sparkline type (Line, Column, WinLoss).

Possible values: `Line`, `Column`, `Stacked`

**-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:4A9474079C13010C2C4F70504C3198BF72B6636F49E40490576B7276513B57BA -->
