Sparklines

Inline mini-charts inside cells — line, column, or win/loss

Sparklines are mini-charts rendered inside a single cell. They're authored as SPARKLINE() formulas, which means they live alongside the rest of the calculation graph — referenced cells recompute the sparkline on change, copy/paste duplicates the formula, and XLSX + ODS round-trip preserves every option.

Basic usage

Type =SPARKLINE(A1:A10) into a cell. The cell's effective value becomes a sparkline structured value, the renderer paints the chart, and the formula bar still shows the source.

A1:A10 = numeric values
B1     = =SPARKLINE(A1:A10)        // line sparkline (default)
B2     = =SPARKLINE(A1:A10, {"charttype","column"})
B3     = =SPARKLINE(A1:A10, {"charttype","winloss"})

Options

SPARKLINE takes an optional second argument — a flat array of "key", value pairs in Excel array literal syntax ({…}). All options round-trip both directions through XLSX (<x14:sparklineGroup> attributes) and via SPARKLINE formula text.

Chart type + color

=SPARKLINE(A1:A10, {"charttype","line"})
=SPARKLINE(A1:A10, {"charttype","column"})
=SPARKLINE(A1:A10, {"charttype","winloss"})
=SPARKLINE(A1:A10, {"color","#638ec6"})

Axis options

Point highlights

Axis bounds

By default each sparkline scales to its own min/max ("individual"). Switch to a group-wide or custom scale:

Line weight

Composing options

Combine any of the above in a single options block:

XLSX round-trip

Sparklines export as <x14:sparklineGroup> blocks inside the worksheet's extLst. Two sparklines share a group when every axis option matches; distinct settings each get their own group block. The exporter follows Excel's grouping rule precisely so a saved-and-reopened file produces the same UI.

The legacy default highlight behavior (markers + high + low for line; high + low + negative for column / winloss) ships unchanged for bare SPARKLINE(range) formulas without explicit options.

ODS round-trip

LibreOffice's calcext:sparkline-groups extension is parsed on import and emitted on export.

Working with structured values

A sparkline cell's ev.structuredValue is a SparkLineResult:

Custom renderers can read this directly and replace the default chart implementation.

Last updated