0
votes

My goal is to retrieve the 13 last data logged to a Google Spreadsheet through a Google Form and to display them in a Chart on a Google Site.

To do so, I created a Google Script associated with the Google Spreadsheet which reads the last 13 rows of the Spreadsheet and create a new chart based on them. Then I have embedded the chart on my Google Site with Live Mode.

When I enter a new value through the form, the chart created by the script on the Spreadsheet is correctly updated and show 13 values. But the version embedded on the Google Site adds the new value to the range without hiding the 14th thus showing 14 ones (and as more values as I enter afterwards).

To fix the issue, I retrieve the Google Site in the script and every time delete the previous chart and embed the new chart generated by the Google Spreadsheet. However the SitesApps does not seem to enable to retrieve and manage the Chart object easily.

My questions are: - Do you see an easier way to do what I currently what to do ? - Do you know a way to retrieve and manage the Chart Object embedded in a Google Site through Google Script ?

What I want to do looks like that :

var site = SitesApp.getSiteByUrl('siteUrl');
var page = Site.getChildByName('home');
var chart = page.getHtmlContent(). ??? Function to get the Chart object ???

Thanks in advance for your help.

1

1 Answers

0
votes

Not really. You'll have to search for the text you want to replace in the HTML content. What you could do instead, though, is make a UiApp gadget that generates the charts whenever it's loaded.