Get/Change Chart name.(Microsoft Excel Office Scripts)
How to get/change the name of a chart in Office scripts.
Not the title that appears on the chart,
The name of the graph as it appears in the name box (where cell addresses are displayed).
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.
When a chart is newly created or a chart is acquired by indexing with getCharts(), the chart name is not known, so this function is used when the chart name is needed.
chart variable.setName("Chart name after change");
For those who want to learn Office scripting effectively
The information on this site is now available in an easy-to-read e-book format for $3.00.
Or Kindle Unlimited (unlimited reading).
You willl discover how to about basic operations.
By the end of this book, you will be equipped with the knowledge you need to use Excel Office Scripts to streamline your workflow.