insertChart throws exception: Service Spreadsheets failed while accessing document with id

I'm trying to copy a chart from one spreadsheet (spreadsheet_a_id) to another using the following code:

function copy_chart() {
  var chart_sheet = SpreadsheetApp.openById(spreadsheet_a_id).getSheetByName("Sheet1");
  var chart = chart_sheet.getCharts()[0];
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  ss.getActiveSheet().insertChart(chart);  // Line fails
}

However, the line ss.getActiveSheet().insertChart(chart); throws the following exception:

Exception: Service Spreadsheets failed while accessing document with id ***

What would be the reason for that?



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation