Is there a way to convert/export a Google Sheets Chart into Google Apps Script?

149 Views Asked by At

Simply, I have created a chart by inserting a chart and adding range/settings etc.

But I have realised that when resizing the chart (by recording a macro) all the settings are lost.

Is there a way to convert the Google Sheets Chart into Google Apps Script, otherwise I think I will have to re-create the graph in Google Apps Script. Just hoping to save some time with this query.

Thank you in advance.

1

There are 1 best solutions below

0
On

I understood that you want to create a graph in Apps Script in a similar way that you did in a Sheet. If I understood it right, then you can complete your aim by using Charts Service. You can see a full example in the linked documentation.

Just to clarify it, first you would need to create a table using DataTableBuilder. This table should be equal to the one in your Sheet. After that you can create a graph based on that table. Please, ask me any question if you still have doubts.