某些方法/函数在 onEdit 触发器中根本不起作用 [英] Some methods/functions simply do not work in onEdit trigger

查看:24
本文介绍了某些方法/函数在 onEdit 触发器中根本不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望根据用户在工作表上的输入调用 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.

推荐答案

onOpenonEdit 这样的简单触发器不能做任何需要授权的事情,比如发送邮件,因为他们默默地和匿名地运行.这在文档 中都有说明.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆