Delete chart.(Microsoft Excel Office Scripts)
Introduction to deleting graphs in Office scripts.
You must first get the target chart.
chart variable = workbook.getWorksheet("Sheet name").getCharts()[index];
chart variable = workbook.getWorksheet("Sheet name").getChart("Chart name");
This can also be done with the return value (variable) of the result added with addChart().
If the acquisition fails, the result is undefined.
The chart name specified to getChart() is displayed in the name box.
The retrieved result is then used to delete it with the following syntax