Google Spreadsheets“您无权调用抓取方式” [英] Google Spreadsheets "You do not have permission to call fetch"

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

问题描述

我在谷歌电子表格中使用了脚本编辑器,我希望能够做出一个简单的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 函数

I used the onEdit Function

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.

推荐答案

简单触发器无法使用需要授权的功能重命名该功能,然后创建一个已安装的 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 Spreadsheets“您无权调用抓取方式”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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