How to Use SPARKLINE in Google Sheets: Simple Guide
Use the
SPARKLINE function in Google Sheets to create small charts inside a cell. The basic syntax is =SPARKLINE(data, [options]), where data is the range of values and options customize the chart type and style.Syntax
The SPARKLINE function has two parts:
- data: The range or array of numbers you want to visualize.
- options (optional): A set of key-value pairs to customize the chart type, color, and style.
Example syntax:
=SPARKLINE(A1:A10, {"charttype", "line"})
plaintext
=SPARKLINE(data, [options])
Example
This example creates a simple line sparkline from values in cells A1 to A5.
plaintext
=SPARKLINE(A1:A5, {"charttype", "line"})Output
A small line chart inside the cell showing trends of values in A1 to A5
Common Pitfalls
- Not using a numeric range for
datacauses errors or no chart. - Forgetting to use curly braces
{}around options or incorrect key-value pairs leads to no effect. - Using unsupported chart types or misspelled options will default to a line chart or error.
Correct option format example: {"charttype", "bar"}
plaintext
=SPARKLINE(A1:A5, {"charttype", "bar"}) // Correct usage
=SPARKLINE(A1:A5, "charttype", "bar") // Incorrect, missing bracesQuick Reference
| Option | Description | Example Value |
|---|---|---|
| charttype | Type of sparkline chart | "line", "bar", "column", "winloss" |
| color | Color of the chart | "red", "blue", "#00FF00" |
| linewidth | Thickness of line (for line charts) | 2 |
| max | Maximum value for scale | 100 |
| min | Minimum value for scale | 0 |
Key Takeaways
Use =SPARKLINE(range, {"charttype", "type"}) to create mini charts inside cells.
Always provide numeric data ranges for the sparkline to work correctly.
Customize chart type and colors using the options parameter with key-value pairs inside curly braces.
Common chart types include line, bar, column, and winloss.
Incorrect option formatting or unsupported types cause errors or default charts.