title: Why does the insertchart function not work in Google Apps Script?
body: <p>Hello I use the code below and get the following error: <strong>Exception: Service error: Tables (line 6, file "Macros")</strong> 
  Does anyone have an idea why this error occurs?</p>
  
  <pre><code>function AuswertungTest2() {
    var sheet = SpreadsheetApp.getActiveSheet();
    var newSpreadsheet = SpreadsheetApp.create("new spreadsheet1");
    var newSheet = newSpreadsheet.getSheets()[0];
    var chart = sheet.getCharts()[0];
    chart = chart.modify().setPosition(2, 2, 0, 0).build();
    newSheet.insertChart(chart); 
  };
  </code></pre>