Is there a way to format data points when creating a chart using Apps Script?

Viewed 355

I want to write a Apps Script in Google Sheets that pulls data from a sheet and uses the conditional formatting of cells to colour the corresponding columns in a columns chart. This is easy to do in Sheets itself: once you've created the column chart you can just double-click on a individual column and then modify the format (or go to the Chart Editor, Customize, Series, Format then "Format data point). However, it seems to be missing from the chart configuration options: https://developers.google.com/apps-script/chart-configuration-options?hl=en#column-config-options

Am I correct that this is a missing option? If so, is there some way I could work around this?

1 Answers

Answer:

In spreadsheet embedded charts, it is not possible to specify the color for a specific column programmatically.

Reference:

Here is the list of methods for building and customizing a column chart: EmbeddedColumnChartBuilder. It doesn't include any method for this. setColors(cssValues) simply modifies the color of all columns in the chart, using the first value in the provided array.

This doesn't seem to be accessible in Sheets API either (see ChartSpec).

File a feature request:

If you think this functionality could be useful, I'd suggest you to request it in Issue Tracker using this template.

Related