Cmdlet
Add-OfficeExcelSparkline
Adds sparklines to a worksheet.
Syntax
Add-OfficeExcelSparkline
[-AxisColor <OfficeColor>]
-DataRange <String>
[-Document <ExcelDocument>]
[-FirstColor <OfficeColor>]
[-HighColor <OfficeColor>]
[-LastColor <OfficeColor>]
-LocationRange <String>
[-LowColor <OfficeColor>]
[-MarkerColor <OfficeColor>]
[-NegativeColor <OfficeColor>]
[-PassThru]
[-SeriesColor <OfficeColor>]
[-Sheet <OfficeSheetSelector>]
[-ShowAxis]
[-ShowFirstLast]
[-ShowHighLow]
[-ShowMarkers]
[-ShowNegative]
[-Type <Line| Column| Stacked>]
[<CommonParameters>]#Parameter set:
DefaultExamples
Add line sparklines
Open-OfficeExcel -Path .\Reports\Budget-2027.xlsx {
ExcelSheet 'Departments' {
ExcelSparkline -DataRange B2:M20 -LocationRange N2:N20
}
}Draws a sparkline for each row of monthly figures in the column next to them.
Show weekly trends with high and low points
New-OfficeExcel -Path .\Reports\Site-Incidents.xlsx {
ExcelSheet 'Incidents' {
ExcelTable (Import-OfficeCsv -Path .\Data\Incidents-By-Week.csv) -Name Incidents
ExcelSparkline -DataRange B2:M9 -LocationRange N2:N9 -Type Column -ShowHighLow
}
}Adds column sparklines with the highest and lowest weeks marked, so each site's pattern is visible at a glance.
Parameters
- -AxisColor OfficeColor
- Axis color. Named colors and hexadecimal values are accepted.
- -DataRange String
- A1 range containing source data (e.g., "B2:M2").
- -Document ExcelDocument
- Workbook to operate on outside the DSL context.
- -FirstColor OfficeColor
- First point color. Named colors and hexadecimal values are accepted.
- -HighColor OfficeColor
- High point color. Named colors and hexadecimal values are accepted.
- -LastColor OfficeColor
- Last point color. Named colors and hexadecimal values are accepted.
- -LocationRange String
- A1 range where the sparklines will be placed (e.g., "N2:N2").
- -LowColor OfficeColor
- Low point color. Named colors and hexadecimal values are accepted.
- -MarkerColor OfficeColor
- Markers color. Named colors and hexadecimal values are accepted.
- -NegativeColor OfficeColor
- Negative point color. Named colors and hexadecimal values are accepted.
- -PassThru SwitchParameter
- Emit the worksheet after adding sparklines.
- -SeriesColor OfficeColor
- Series color. Named colors and hexadecimal values are accepted.
- -Sheet OfficeSheetSelector
- Worksheet name when using Document.
- -ShowAxis SwitchParameter
- Show axis.
- -ShowFirstLast SwitchParameter
- Show first/last points.
- -ShowHighLow SwitchParameter
- Show high/low points.
- -ShowMarkers SwitchParameter
- Show markers for each point.
- -ShowNegative SwitchParameter
- Show negative points.
- -Type ExcelSparklineType
- Sparkline type (Line, Column, WinLoss).
- Possible values:
Line,Column,Stacked
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.