title: How to update chart embedded in Google Site using Google Script
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>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).</p>
  
  <p>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.</p>
  
  <p>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 ?</p>
  
  <p>What I want to do looks like that :</p>
  
  <pre><code>var site = SitesApp.getSiteByUrl('siteUrl');
  var page = Site.getChildByName('home');
  var chart = page.getHtmlContent(). ??? Function to get the Chart object ???
  </code></pre>
  
  <p>Thanks in advance for your help.</p>