Chart

Google Sheets SPARKLINE Function — Syntax, Examples & Tips

Learn how to use the SPARKLINE function in Google Sheets to create miniature charts inside cells. Includes syntax for line, bar, column, and win/loss charts.

Syntax
=SPARKLINE(data, [options])

What SPARKLINE Does

The SPARKLINE function renders a tiny chart inside a single cell, giving you a visual summary of data without creating a full chart object. It supports line charts, bar charts, column charts, and win/loss charts. Sparklines are perfect for dashboards, summary tables, and reports where you want to show trends at a glance without taking up extra space.

Syntax

=SPARKLINE(data, [options])
ParameterDescription
dataA range or array of numeric values to visualize.
optionsOptional. A set of key-value pairs enclosed in curly braces that control chart type and appearance.

Key options

OptionValuesDescription
"charttype""line", "bar", "column", "winloss"The type of sparkline. Default is "line".
"color"Color name or hex codeLine or bar color.
"linewidth"NumberThickness of the line (line chart only).
"max" / "min"NumberFixed axis bounds.
"highcolor"Color name or hexColor for the highest point.
"lowcolor"Color name or hexColor for the lowest point.
"empty""zero" or "ignore"How to handle empty cells.

Basic Examples

Simple line sparkline

ABCDEF
1JanFebMarAprMayTrend
2120135128150162=SPARKLINE(A2:E2)

Cell F2 displays a small line chart showing the upward trend across five months. No configuration needed — the default line chart works out of the box.

Bar chart showing progress

To display a single value as a progress bar (e.g., 75% completion):

=SPARKLINE({0.75}, {"charttype","bar"; "max",1; "color","#4285F4"})

Result: A horizontal blue bar filling 75% of the cell. This is commonly used for project trackers and KPI dashboards.

Column chart for monthly values

ABCD
1Q1Q2Q3Q4
285009200780010400
=SPARKLINE(A2:D2, {"charttype","column"; "color","#34A853"})

This renders four green vertical bars in the cell, one per quarter. The tallest bar corresponds to Q4 (10,400).

Advanced Examples

Win/loss chart for game results

Suppose you track wins (1) and losses (-1) across a season:

ABCDEFG
11-111-1-11
=SPARKLINE(A1:G1, {"charttype","winloss"; "color","#34A853"; "negcolor","#EA4335"})

Wins appear as green bars above the baseline, losses as red bars below. This gives an instant visual read on streaks and overall performance.

Line sparkline with highlighted extremes

=SPARKLINE(B2:M2, {"linewidth",2; "color","#4285F4"; "highcolor","#34A853"; "lowcolor","#EA4335"})

This draws a blue line across 12 months of data. The highest point is marked in green and the lowest in red, making it easy to spot peak and trough months at a glance. The linewidth of 2 makes the line slightly thicker and easier to read.

Common Mistakes

  • Passing non-numeric data into the data range. SPARKLINE only works with numbers. If your range includes text headers or blank cells interpreted as text, the chart will not render correctly. Make sure the data range contains only numeric values.
  • Forgetting the semicolons in the options array. Options are structured as {"key","value"; "key2","value2"} with semicolons separating pairs and commas separating keys from values. Using commas everywhere or forgetting the semicolons will cause a parse error.
  • Expecting sparklines to resize automatically. The chart fills whatever cell it is in. If the row is too short, the sparkline looks squished. Increase the row height or column width to give the sparkline more room to render clearly.

SheetAI Tip

Don't want to memorize this syntax? With SheetAI, just type what you need in plain English and the formula is generated for you. Install SheetAI to try it free.

Skip the formula. Describe what you need.

SheetAI lets you type what you want in plain English and generates the perfect formula — no syntax to memorize.

Try SheetAI Free