[英]handle cell click - Google Spreadsheet - Appscript
Is there a way to mimic the onclick
function using google app script?有没有办法使用谷歌应用脚本模仿
onclick
function ?
I already checked online but could not anything in the official documentation, and the only useful post in StackOverflow is the following: How can you monitor for click events in Google Apps script for spreadsheets?我已经在网上查过了,但在官方文档中什么也查不到,StackOverflow 中唯一有用的帖子如下: 如何在电子表格的 Google Apps 脚本中监控点击事件? but it's an old post from 2013.
但这是2013年的旧帖子。
Does anyone know if anything changed since then?有谁知道从那以后有什么变化吗?
You can use a simple onSelectionChange trigger for that.您可以为此使用简单的onSelectionChange触发器。
Just add a function named on onSelectionChange
and save the project.只需添加一个名为
onSelectionChange
的 function 并保存项目。 From now on, every time a different cell is selected, this function will execute.从现在开始,每次选择不同的单元格时,这个 function 都会执行。
function onSelectionChange(e) {
console.log("A NEW CELL WAS SELECTED!");
console.log(JSON.stringify(e));
}
JSON.stringify(e)
, as shown in the sample above.JSON.stringify(e)
来检查这些属性,如上面的示例所示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.