-
Notifications
You must be signed in to change notification settings - Fork 517
excel sparkline add
zmworm edited this page Apr 29, 2026
·
36 revisions
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}
| 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 |
| Property | Default | Notes |
|---|---|---|
type |
line |
Sparkline type: line, column, stacked (aliases for stacked: winloss, win-loss) |
| Property | Default | Notes |
|---|---|---|
color |
4472C4 |
Main sparkline color. Accepts hex RGB (4472C4, #FF0000, rgb(255,0,0)) |
negativecolor |
-- | Color for negative value segments |
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 |
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 |
| Property | Default | Notes |
|---|---|---|
lineweight |
-- | Line thickness in points (applies to line type) |
# 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 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# 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# 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# 'data' works as an alias for 'range'
officecli add data.xlsx /Sheet1 --type sparkline \
--prop cell=F1 --prop data=A1:E1# Reference data from a different sheet
officecli add data.xlsx /Sheet1 --type sparkline \
--prop cell=F1 --prop range=Sheet2!A1:E1Returns the path to the created sparkline group:
/{SheetName}/sparkline[N]
where N is the 1-based index among all sparkline groups in the sheet.
- Sparkline - Overview, get, set, remove
- Excel Reference - All Excel elements
Based on OfficeCLI v1.0.64