Google脚本编辑器OnChange触发器无法正常工作(Google Script Editor OnChange Trigger not Working)

编程入门 行业动态 更新时间:2024-10-17 19:24:34
Google脚本编辑器OnChange触发器无法正常工作(Google Script Editor OnChange Trigger not Working)

我在google工作表脚本编辑器中运行脚本,以触发我使用可安装触发器onChange()的脚本。 我按照文档中提供的步骤进行操作。 但是当我在工作表上做某事时,什么也没发生。

这是我的代码

function createSpreadsheetChangeTrigger() { var ss = SpreadsheetApp.getActive(); ScriptApp.newTrigger('onChange') .forSpreadsheet(ss) .onChange() .create(); } function onChange(){ Logger.log("onChange event fired"); }

我不明白出了什么问题。 有人可以帮我吗?

谢谢

I am running a script in google sheets script editor, to trigger the script I use the installable trigger onChange(). I followed the steps available on in the documentations. But nothing happen when I do something on my worksheet.

Here is my code

function createSpreadsheetChangeTrigger() { var ss = SpreadsheetApp.getActive(); ScriptApp.newTrigger('onChange') .forSpreadsheet(ss) .onChange() .create(); } function onChange(){ Logger.log("onChange event fired"); }

I don't understand what is going wrong. Can anyone help me please?

Thanks

最满意答案

你有什么工作,但你必须首先实际“安装”触发器。 要做到这一点,请转到编辑 - >当前项目的触发器。 单击链接无触发器设置。 点击此处立即添加一个并进行以下选择:

在此处输入图像描述

现在,在更改电子表格后检查您的记录器,您会得到:

在此处输入图像描述

希望这可以帮助!

What you have will work, but you have to actually "install" the trigger first. To do that go to Edit --> Current Project's Triggers. Click on the link No triggers set up. Click here to add one now and make the selections below:

enter image description here

Now check your Logger after making a change to your spreadsheet and you get:

enter image description here

Hope this helps!

更多推荐

onChange,function,脚本,电脑培训,计算机培训,IT培训"/> <meta name="descript

本文发布于:2023-07-18 04:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1154850.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:触发器   编辑器   无法正常   脚本   工作

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!