Google 电子表格“您无权调用 fetch" [英] Google Spreadsheets "You do not have permission to call fetch"

查看:20
本文介绍了Google 电子表格“您无权调用 fetch"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 google 电子表格中使用脚本编辑器,我希望能够发出简单的 HTTP 请求,但我不断收到以下错误消息:

I am using the script editor in google spreadsheets, and I want to be able to make a simple HTTP request, but I keep getting the following error message:

Google Apps 脚本:您无权调用 fetch

我使用了 onEdit 函数

function onEdit(e){
  var ui = SpreadsheetApp.getUi();
        var response = UrlFetchApp.fetch('http://www.google.com/');
    Logger.log(response.getContentText());
  } 

为什么我会收到这个错误?任何帮助将不胜感激.

Why am I getting this error? Any help would be appreciated.

推荐答案

简单触发器无法使用需要授权的功能 重命名该功能,然后创建a> 一个已安装的 onEdit 触发器.在脚本编辑器中手动调用它,继续完成授权流程,然后该功能将按您的预期工作.

Simple triggers cannot use functionality that requires authorization Rename the function, then create an installed onEdit trigger for it. Call it manually within the Script Editor, proceed through the Authorization flow, and then the functionality will work as you expect.

请注意,对于具有配额的事物(例如 UrlFetch),您可能希望在范围检查等之后对调用进行门控(即 event.range.getColumn() 是所需的值等)).

Note that for things with quotas (such as UrlFetch), you may want to gate the call behind range checks, etc. (i.e. is event.range.getColumn() a desired value, etc).

这篇关于Google 电子表格“您无权调用 fetch"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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