Google Sheets logo

When you’re working with large amounts of data in a Google Sheets spreadsheet, it isn’t always convenient to drop a chart into the mix. To help you, you can create one-cell charts using the SPARKLINE function instead.

A sparkline chart is a very small line chart that allows you to quickly visualize your data. It’s useful if you want to quickly see if share price data in a spreadsheet was going up or down, for instance.

The SPARKLINE function in Google Sheets allows you to insert these types of charts into a single cell on your spreadsheet. While a sparkline is typically a line chart, the SPARKLINE function enables you to create alternatives, including single-cell bar and column charts.

Inserting Basic Sparklines into Google Sheets

The SPARKLINE function can be used simply, with no additional formatting or options applied. All you need is a set of data in a single row or column that can be used to create a sparkline chart, such as a range of figures that go up or down.

The typical format for creating a very basic sparkline, with no additional formatting or options, is =SPARKLINE(data). Replace “data” with the cell range that contains your data.

In the example below, cells A3 to D3 contain a set of numbers from 1 to 100. A sparkline inserted into cell A5 using the SPARKLINE function has created a visual representation of this data.

The SPARKLINES function in Google Sheets, creating a basic sparklines chart using a range of data over four cells

The visualization shows the variation in the numbers, with a line that goes up (12 to 44) and then down (44 to 8) before rising sharply (8 to 98) to complete the chart. The sparkline fills the entire cell.

Creating Different Types of Sparklines

While a basic sparkline requires no additional options, the SPARKLINE function does allow for other types of single-cell charts to be created.

Using SPARKLINE, you can create a bar, column, or win/loss chart, along with the typical line chart shown above.

Various types of sparkline charts, created using the SPARKLINE function in Google Sheets

To do that, you need to add options to your SPARKLINE formula. The format for adding additional options, including selecting the type of chart to generate, is =SPARKLINE(data, {option, choice}) where “option” is a SPARKLINE option, and “choice” is the matching choice for that option.

Switching to different types of sparklines requires you to use the “charttype” option. You don’t need to set this for standard line charts, but for other types of sparklines, use =SPARKLINE(data,{"charttype","bar / column / winloss"}).

Delete the types of charts you don’t want to use as appropriate.

Formatting Google Sheets Sparklines

The “options” section of a SPARKLINE formula is an array, allowing you to use multiple criteria to format your sparkline.

Changing Line Sparkline Colors

For the four types of sparkline charts that the SPARKLINE function can create, various “color” options exist to allow you to alter the color of the line or bars it creates.

As line sparklines consist of a single line, there is only a single “color” option.

To change this, type =SPARKLINE(data, {"color","red"}) and replace the color with either a name or a color hex code.

A Google Sheets SPARKLINE formula with the "color" option set to red applied.

Changing Column and Win/Loss Sparkline Colors

Column and win/loss sparklines have multiple color options.

These include “lowcolor” to set the color for the column with the lowest value, “highcolor” for the column with the highest value, “firstcolor” for the first column, “lastcolor” for the last column, “axiscolor” to set the color of any axis lines, and “negcolor” for any negative value columns.

Like the standard line sparkline, you can also set “color” to set a general color for all column values.

For column sparklines, type=SPARKLINE(data, {"charttype","column"; "color","red"}). For win/loss sparklines, type =SPARKLINE(data, {"charttype","winloss"; "color","red"}).

Add the various “color” options as appropriate, separating them each with a semi-colon.

Various color formatting options for SPARKLINE formulae in Google Sheets

While it isn’t a requirement, you can use an additional option for win/loss charts (“axis” set to “true”) to show the dividing line between the “win” and “loss” options.

Changing Bar Sparkline Colors

Bar sparklines, by default, display two bars. The “color1” and “color2” options allow you to set the color for each bar.

To do this, type =SPARKLINE(data, {"charttype","bar"; "color1","red"; "color2","blue"}), replacing the colors with your own choice.

Color formatting options for bar sparkline charts using the SPARKLINE function in Google Sheets

Formatting Sparklines Using Text Color

You can also edit the color of line, bar, and win/loss sparklines quickly by clicking on the cell and changing the applied text color. This will work only if you haven’t applied “color” options within your SPARKLINE formula because these will take priority over any direct cell formatting you apply.

To do this, click on your cell, and then select your color from the “Text Color” drop-down menu in the formatting toolbar.

Additional Sparkline Options

Additional options you can apply to a SPARKLINE formula allow you to change how your sparkline is generated.

Sparkline charts in Google Sheets, using the SPARKLINE function, with additional formatting options applied

The “rtl” option (with “true” or “false” values) will shift a sparkline from right to left and works for all SPARKLINE formula chart types.

You can use “max” (using “true” or “false”) to set the maximum value for the entire chart. In the example above, the values of A3 and B3 would need to add up to 100 for the entire cell to be filled. This option is only applicable to bar sparkline charts.

To increase the width of a line sparkline chart, use the “linewidth” option, using a numerical value to set the width. The higher the number, the thicker the line.

Profile Photo for Ben Stockton Ben Stockton
Ben Stockton is a freelance tech writer from the United Kingdom. In a past life, he was a UK college lecturer, training teens and adults. Since leaving the classroom, he's been a tech writer, writing how-to articles and tutorials for MakeUseOf, MakeTechEasier, and He has a degree in History and a postgraduate qualification in Computing.
Read Full Bio »