UrlFetchApp.fetch()在onEdit触发器中不起作用 [英] UrlFetchApp.fetch() simply does not work in onEdit trigger

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

问题描述

我打算根据表单上的用户输入调用 UrlFetchApp.fetch(),但没有任何反应。没有错误,只是默默地忽略了电话。同样适用于 MailApp.sendEmail() GmailApp.sendEmail()



这是在Google Apps网域中,并且只有网域用户正在使用Google表格。

解决方案

简单触发器例如 onOpen onEdit 无法做任何需要授权的事情,例如发送邮件,因为它们以匿名方式运行。
这些都在文档中有所解释。



您应该简单地将您的 onEdit 函数重命名为 - SpecialOnEdit 例如? - 并从脚本编辑器菜单中创建可安装触发器(文档) ressources /触发器/创建一个新的触发器...)

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()

This is on a Google Apps domain, and only domain users are using the Google Sheet.

解决方案

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 .

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...)

这篇关于UrlFetchApp.fetch()在onEdit触发器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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