0

I'm trying to automate graph generation through google apps script, but the one setting I cannot find anywhere in the documentation is how to change the way the data is aggregated from sum to average in google apps script.

I looked through the documentation and attempted to follow the instructions from Google Apps Script: How to set "Use column A as labels" in chart embedded in spreadsheet?, but there didn't seem to be any change in the JSON object.

  • For now, I couldn't find any documentation regarding this either. What do you want to do with the json file? – Jescanellas Jul 05 '19 at 15:02
  • I don't want to modify the JSON object at all, but the answer I linked seemed to indicate that it could be used to reverse engineer undocumented google apps script options. – Eric Palmer Jul 05 '19 at 15:19

1 Answers1

1

I finally solved it. It turns out I was looking at the wrong JSON object, and the setting is called "aggregateFunction", which I set to average. However, you can't set it directly using setOption. Instead, you must set it for each series in the chart, for example:

.setOption("series", {"0":{"aggregateFunction":"average"}})