在 Google 电子表格事件上运行 Google Apps 脚本?
如果我创建 Google Apps 脚本,我可以将其连接到 Google 电子表格以根据事件运行,还是必须手动调用它?
我不知道 Google 表格是否支持任何事件。
例如:Google 应用程序脚本会删除电子表格中已通过在已完成的行旁边具有数字 1 的列标记为已完成的行。我希望每当修改一行时,甚至在首次加载电子表格时,都可以运行它。
If I create a Google apps script, can I hook it up to Google spreadsheet to run based on an event, or must I manually invoke it?
I don't know if Google Sheets supports any events.
For example: a Google app script that strikes out rows in the spreadsheet that have been marked completed by way of a column having the digit 1 beside completed rows. I would like this to run whenever a row is modified, or even when the spreadsheet is first loaded.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每次加载电子表格时,
onOpen()
函数都会自动执行。将来,我们将公开通用事件 API,但在此之前您可以简单地定义自己的函数,只要调用onOpen()
即可。来自教程的第2部分
还有函数
onEdit()
可以在以下位置查看:http://www.google.com/support/forum/p/apps-script/thread?tid=584a17c79e4c04d5&hl=en
事件处理似乎在不断变化并取决于正在解决的安全问题。
The function
onOpen()
is automatically executed every time a Spreadsheet is loaded. In the future, we will expose a general event API, but until then you can simply define your own function as long as it is calledonOpen()
.From the Section 2 of the Tutorial
There is also function
onEdit()
as can be viewed in at:http://www.google.com/support/forum/p/apps-script/thread?tid=584a17c79e4c04d5&hl=en
It seems that event handling is in flux and dependent on security issues being worked out.