gpt4 book ai didi

google-apps-script - 如何获取当前选定的单元格/范围?

转载 作者:行者123 更新时间:2023-12-04 02:01:54 43 4
gpt4 key购买 nike

有没有办法获取Google表格中所选单元格或范围的标识(即A1表示法)?

就像是:

=SELECTION(['Sheet1']) -> "D6"

最佳答案

在使用该功能更新单元格时,此自定义功能将获得选择。但是它不会随着选择的更改而更新。

Henrique很好地解释了为什么这样的自定义函数不会在Google Apps - script to summarise data not updating中更新。

/**
* A function that gets the current selection, in A1Notation.
*
* @customfunction
*/
function SELECTED_RANGE() {
return SpreadsheetApp.getActive().getActiveRange().getA1Notation();
}

关于google-apps-script - 如何获取当前选定的单元格/范围?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30779426/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com