某些方法/功能根本无法在onEdit触发器中使用 [英] Some methods/functions simply do not work in onEdit trigger
问题描述
我希望根据工作表上的用户输入来调用UrlFetchApp.fetch()
,但是什么也没有发生.没有错误,只是默默地忽略了呼叫. MailApp.sendEmail()
和GmailApp.sendEmail()
I'm looking to call UrlFetchApp.fetch()
based on user input on a sheet but nothing happens. No errors, just silently ignores the call. Same goes for MailApp.sendEmail()
and GmailApp.sendEmail()
这是在Google Apps域上,只有域用户在使用Google表格.
This is on a Google Apps domain, and only domain users are using the Google Sheet.
推荐答案
像onOpen
或onEdit
这样的简单触发器无法执行任何需要授权的操作,例如发送邮件,因为它们以静默方式匿名运行.
所有这些都在文档中进行解释.
Simple triggers like onOpen
or onEdit
are not able to do anything that requires authorization like sending mails because they run silently and anonymously.
This is all explained in the documentation .
您应该简单地将onEdit
函数重命名为其他名称-例如SpecialOnEdit
? -并从脚本编辑器菜单中创建一个可安装的触发器(文档)(资源/触发器/创建新触发器...)
You should simply rename your onEdit
function to something else - SpecialOnEdit
for example ? - and create an installable trigger (documentation) from the script editor menu (ressources/triggers/create a new trigger...)
这篇关于某些方法/功能根本无法在onEdit触发器中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!