I want to import a graphical evaluation (diagram) into a new file using a macro. So the evaluation should not be inserted on a new sheet in the associated file, but a completely new file should be created, in which the graphical evaluation (in the form of a combination diagram) is then copied. The file should be either a Google Sheets or an Excel file. The combination diagram already exists and is located in a Google sheet, but it should be copied into a new file automatically with the help of a macro and the corresponding button. The code below unfortunately only inserts an empty sheet. Where is my error? The chart will depend on the data in the new Spreadsheet, so I need to have the data in the new spreadsheet using importrange. How can I modify the data range with addRange function. The code below unfortunately does not work. Like this an empty chart is inserted. Error Exception: Service error: Tables (line 7, file "Macros") (insertChart Line)
function Auswertung2() {
var sheet = SpreadsheetApp.getActive().getSheetByName("Evaluation");
var newSpreadsheet = SpreadsheetApp.create("new spreadsheet");
var newSheet = newSpreadsheet.getSheets()[0];
var chart = sheet.getCharts()[0];
chart = chart.modify().addRange(sheet.getRange("A1:AX80")).setPosition(7, 7, 0, 0).build();
newSheet.insertChart(chart);
};```