Google 电子表格脚本 onChange 事件未触发 [英] Google Spreadsheet Script onChange event not firing
本文介绍了Google 电子表格脚本 onChange 事件未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试触发 onChange 事件,但它不起作用.
I am trying to fire an onChange event and it is not working.
我有以下简单的代码:
function onChange(){
Logger.log("onChange event fired");
}
function onEdit(){
Logger.log("onEdit event fired");
}
https://developers.google.com/apps-script/understanding_events
根据本文档,插入行时应触发 onChange 事件.它不会被解雇.onEdit 函数在您操作单元格时被触发,但我需要在用户插入一行时触发一个事件.
According the this document, the onChange event should be fired when a row is inserted. It does not get fired. The onEdit function gets fired when you manipulate a cell, but I need an event to be fired when the user inserts a row as well.
有什么想法吗?
推荐答案
尝试使用带一个参数的签名:
Try to use signatures with one parameter:
function onChange(e){
Logger.log("onChange event fired");
}
function onEdit(e){
Logger.log("onEdit event fired");
}
然后在 ScriptEditor 中注册这些函数:
And then register those functions in ScriptEditor:
这篇关于Google 电子表格脚本 onChange 事件未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文