Project

PSWriteOffice

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

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Add-OfficeExcelSparkline

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

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

Examples

Add a line sparkline.

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.