Using SPARKLINE Charts in Google Sheets
Sparkline charts are compact, in-cell charts that allow you to visually represent trends in your data. They are ideal for quickly spotting upward or downward trends without taking up much space in your spreadsheet.
Google Sheets provides a built-in SPARKLINE()
function that supports various chart types, including line, column, bar, and win/loss charts—all within a single cell.
1. Basic Line Sparkline Chart
The line chart is the default chart type when using the SPARKLINE()
function.
Formula: =SPARKLINE(data_range)
data_range
: The cell range containing the data you want to visualize. This must include at least two cells in a row or column.
If no options are specified, Google Sheets will render a line chart by default.
2. Custom Sparkline Charts (Line, Column, Win/Loss, Bar)
To create more customized sparklines—such as different chart types, colors, and line widths—you can use the extended syntax with options.
Formula: =SPARKLINE(data_range, { "option1", "value1"; "option2", "value2"; ... })
data_range
: The range of cells containing your data.option
: A setting to customize the sparkline chart.value
: The value for that setting.
Examples of options include:
"charttype"
:"line"
,"column"
,"winloss"
, or"bar"
"color"
: Color name (e.g.,"green"
) or hex code (e.g.,"#5E5E5E"
)"linewidth"
: Numeric value to adjust the thickness of a line chart
Color Formatting Notes
You can define chart colors in two ways:
By name:
"red"
,"blue"
,"green"
, etc.By hex code:
"#FF0000"
,"#5E5E5E"
, etc.
For line charts, you can also change the line color by setting the font color of the cell that contains the sparkline.
Quick Example: Custom Line Chart
=SPARKLINE(A1:A10, { "charttype", "line"; "color", "#2196F3"; "linewidth", 2 })
This will render a line chart with a custom blue color and a thicker line.