【发布时间】:2021-06-22 13:08:24
【问题描述】:
有没有办法从 Google 表格单元格中获取 Title Text?
所以每当我更改单元格字符串时,它应该会自动出现在图表中。
例如:我在单元格 A1 中有 May - 2021。我可以在Title Text 中引用它吗,比如使用=A1 或=Sheet1!A1?但它不起作用。
我得到了这段代码,但是如何将单元格引用到代码中?
function onOpen() {
SpreadsheetApp.getUi().createMenu('Charts').addItem('Update', 'myFunction').addToUi();
}
function myFunction() {
var sheet = SpreadsheetApp.getActiveSheet();
var chart = sheet.getCharts()[0];
chart = chart.modify()
.setOption('Summary!Q123', sheet.getActiveCell().getValue() || 'Summary!Q123')
.build();
sheet.updateChart(chart);
}
【问题讨论】:
标签: google-sheets google-sheets-formula