Skip to content

excel sparkline add

zmworm edited this page Apr 29, 2026 · 36 revisions

Excel: Sparkline - add

Add inline sparkline charts to worksheet cells. Each add call creates one sparkline group containing a single sparkline element. The sparkline is stored in the worksheet's extension list as an OOXML x14:sparklineGroup.

Parent: /{SheetName}

Properties

Required

Property Default Notes
cell (required) Target cell where the sparkline is rendered (e.g. F1)
range (required) Data source range (e.g. A1:E1). Alias: data. Sheet prefix is added automatically if omitted

Type

Property Default Notes
type line Sparkline type: line, column, stacked (aliases for stacked: winloss, win-loss)

Series color

Property Default Notes
color 4472C4 Main sparkline color. Accepts hex RGB (4472C4, #FF0000, rgb(255,0,0))
negativecolor -- Color for negative value segments

Point visibility flags

Boolean flags that toggle highlighting of specific data points.

Property Default Notes
markers false Show all data point markers (most useful for line type)
highpoint false Highlight the highest data point
lowpoint false Highlight the lowest data point
firstpoint false Highlight the first data point
lastpoint false Highlight the last data point
negative false Highlight negative data points

Marker colors

Set the color of highlighted data points. These only take effect when the corresponding point visibility flag is also enabled.

Property Default Notes
highmarkercolor -- Color for the high point marker
lowmarkercolor -- Color for the low point marker
firstmarkercolor -- Color for the first point marker
lastmarkercolor -- Color for the last point marker
markerscolor -- Color for all data point markers

Line weight

Property Default Notes
lineweight -- Line thickness in points (applies to line type)

Examples

Basic sparklines

# Line sparkline (default type)
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F1 --prop range=A1:E1

# Column sparkline
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F2 --prop range=A2:E2 \
  --prop type=column

# Stacked (win/loss) sparkline
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F3 --prop range=A3:E3 \
  --prop type=stacked

Custom colors

# Custom series color
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F1 --prop range=A1:E1 \
  --prop color=ED7D31

# With negative color
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F2 --prop range=A2:E2 \
  --prop color=4472C4 --prop negativecolor=FF0000 \
  --prop negative=true

Markers and highlight points

# Show all data point markers
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F1 --prop range=A1:E1 \
  --prop markers=true --prop markerscolor=4472C4

# Highlight high and low points
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F2 --prop range=A2:E2 \
  --prop highpoint=true --prop highmarkercolor=FF0000 \
  --prop lowpoint=true --prop lowmarkercolor=0000FF

# Highlight first and last points
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F3 --prop range=A3:E3 \
  --prop firstpoint=true --prop firstmarkercolor=70AD47 \
  --prop lastpoint=true --prop lastmarkercolor=FFC000

# All markers with distinct colors
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F4 --prop range=A4:E4 \
  --prop markers=true --prop markerscolor=808080 \
  --prop highpoint=true --prop highmarkercolor=FF0000 \
  --prop lowpoint=true --prop lowmarkercolor=0000FF \
  --prop firstpoint=true --prop firstmarkercolor=70AD47 \
  --prop lastpoint=true --prop lastmarkercolor=FFC000 \
  --prop negative=true --prop negativecolor=FF0000

Line weight

# Thicker line sparkline
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F1 --prop range=A1:E1 \
  --prop lineweight=2.5

# Thin line with markers
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F2 --prop range=A2:E2 \
  --prop lineweight=0.75 --prop markers=true

Using data alias

# 'data' works as an alias for 'range'
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F1 --prop data=A1:E1

Cross-sheet data reference

# Reference data from a different sheet
officecli add data.xlsx /Sheet1 --type sparkline \
  --prop cell=F1 --prop range=Sheet2!A1:E1

Return value

Returns the path to the created sparkline group:

/{SheetName}/sparkline[N]

where N is the 1-based index among all sparkline groups in the sheet.

See Also


Based on OfficeCLI v1.0.64

Clone this wiki locally