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-OfficeExcelSparkline

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

Adds sparklines to a worksheet.

Remarks

Adds sparklines to a worksheet.

Examples

Authored help example

Add a line sparkline.

PS>


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

Creates a line sparkline in N2 using B2:M2.

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-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>]
#
Parameter set: Context

Parameters

AxisColor String optionalposition: namedpipeline: False
Axis color. Named colors and hexadecimal values are accepted.
DataRange String requiredposition: namedpipeline: False
A1 range containing source data (e.g., "B2:M2").
FirstColor String optionalposition: namedpipeline: False
First point color. Named colors and hexadecimal values are accepted.
HighColor String optionalposition: namedpipeline: False
High point color. Named colors and hexadecimal values are accepted.
LastColor String optionalposition: namedpipeline: False
Last point color. Named colors and hexadecimal values are accepted.
LocationRange String requiredposition: namedpipeline: False
A1 range where the sparklines will be placed (e.g., "N2:N2").
LowColor String optionalposition: namedpipeline: False
Low point color. Named colors and hexadecimal values are accepted.
MarkersColor String optionalposition: namedpipeline: False
Markers color. Named colors and hexadecimal values are accepted.
NegativeColor String optionalposition: namedpipeline: False
Negative point color. Named colors and hexadecimal values are accepted.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after adding sparklines.
SeriesColor String optionalposition: namedpipeline: False
Series color. Named colors and hexadecimal values are accepted.
ShowAxis SwitchParameter optionalposition: namedpipeline: False
Show axis.
ShowFirstLast SwitchParameter optionalposition: namedpipeline: False
Show first/last points.
ShowHighLow SwitchParameter optionalposition: namedpipeline: False
Show high/low points.
ShowMarkers SwitchParameter optionalposition: namedpipeline: False
Show markers for each point.
ShowNegative SwitchParameter optionalposition: namedpipeline: False
Show negative points.
Type ExcelSparklineType optionalposition: namedpipeline: Falsevalues: 3
Sparkline type (Line, Column, WinLoss).
Possible values: Line, Column, Stacked
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>]
#
Parameter set: Document

Parameters

AxisColor String optionalposition: namedpipeline: False
Axis color. Named colors and hexadecimal values are accepted.
DataRange String requiredposition: namedpipeline: False
A1 range containing source data (e.g., "B2:M2").
Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to operate on outside the DSL context.
FirstColor String optionalposition: namedpipeline: False
First point color. Named colors and hexadecimal values are accepted.
HighColor String optionalposition: namedpipeline: False
High point color. Named colors and hexadecimal values are accepted.
LastColor String optionalposition: namedpipeline: False
Last point color. Named colors and hexadecimal values are accepted.
LocationRange String requiredposition: namedpipeline: False
A1 range where the sparklines will be placed (e.g., "N2:N2").
LowColor String optionalposition: namedpipeline: False
Low point color. Named colors and hexadecimal values are accepted.
MarkersColor String optionalposition: namedpipeline: False
Markers color. Named colors and hexadecimal values are accepted.
NegativeColor String optionalposition: namedpipeline: False
Negative point color. Named colors and hexadecimal values are accepted.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the worksheet after adding sparklines.
SeriesColor String optionalposition: namedpipeline: False
Series color. Named colors and hexadecimal values are accepted.
Sheet String optionalposition: namedpipeline: False
Worksheet name when using Document.
SheetIndex Int32 optionalposition: namedpipeline: False
Worksheet index (0-based) when using Document.
ShowAxis SwitchParameter optionalposition: namedpipeline: False
Show axis.
ShowFirstLast SwitchParameter optionalposition: namedpipeline: False
Show first/last points.
ShowHighLow SwitchParameter optionalposition: namedpipeline: False
Show high/low points.
ShowMarkers SwitchParameter optionalposition: namedpipeline: False
Show markers for each point.
ShowNegative SwitchParameter optionalposition: namedpipeline: False
Show negative points.
Type ExcelSparklineType optionalposition: namedpipeline: Falsevalues: 3
Sparkline type (Line, Column, WinLoss).
Possible values: Line, Column, Stacked