小编Iam*_*hus的帖子

您无权调用“UrlFetchApp.fetch”

我正在从谷歌电子表格中的脚本编辑器发送 http 请求,但我不断收到以下错误消息:

`Google Apps Script: You do not have permission to call UrlFetchApp.fetch. Required permissions: https://www.googleapis.com/auth/script.external_request`
Run Code Online (Sandbox Code Playgroud)

我正在使用 onEdit 功能:

 function onEdit(e){
  var ui = SpreadsheetApp.getUi();
        var response = UrlFetchApp.fetch('http://www.eur-api.idomoo.com/');
    Logger.log(response.getContentText());
  } 
Run Code Online (Sandbox Code Playgroud)

我不知道为什么我会收到这个错误?我还授予了 script.external_request 范围的权限,任何帮助将不胜感激。

google-sheets google-apps-script

16
推荐指数
3
解决办法
5544
查看次数

谷歌脚本中的函数

我尝试缩短gs的基本代码。

function quantityAnalysis (){
  var subscription = magicSheet("dataRaw","Subscription");

  var idCol = msCol(subscription,"Subscription Id");
  var xlCol = msCol(subscription,"XL");
  var goCol = msGoCol(idCol,xlCol);
  var lastRow = msLastRow(subscription);

  var dataToFilter = subscription
  .getRange(1,idCol,lastRow,goCol)
  .getValues();
}
Run Code Online (Sandbox Code Playgroud)

**在第二个文件中**

function magicSheet (ssName,sheet="full"){
  //return sheet
    let id = sMagicSearch("id",ssName);
    if(sheet=="full"){
      return SpreadsheetApp.openById(id);
    }else{
      return SpreadsheetApp.openById(id).getSheetByName(sheet);
    }
  //end return sheet
}
Run Code Online (Sandbox Code Playgroud)

在我这样做之前它一直在工作。

var subscription = magicSheet("dataRaw","Subscription");

function quantityAnalysis (){
  var idCol = msCol(subscription,"Subscription Id");
  var xlCol = msCol(subscription,"XL");
  var goCol = msGoCol(idCol,xlCol);
}
Run Code Online (Sandbox Code Playgroud)

错误:magicSheet 未定义。

还有一件事要告诉:订阅函数在另一个函数中用于将值打印到工作表;

(从另一个文件调用函数的函数是有效的,但将同一函数调用为全局变量是无效的)。

javascript google-apps-script

4
推荐指数
1
解决办法
510
查看次数

PyDrive 快速入门和错误 403:access_denied

我正在尝试将谷歌驱动器照片下载到我的本地驱动器。我认为这应该是一项简单的任务,但实际上具有挑战性,尤其是这是我第一次尝试使用 google API。

\n

按照这个有用的Youtube 视频和此PyDrive 链接中的所有步骤进行操作

\n

我到达了它所说的步骤Rename the file to \xe2\x80\x9cclient_secrets.json\xe2\x80\x9d and place it in your working directory.

\n

然后我运行这段代码

\n
from pydrive.auth import GoogleAuth\n\ngauth = GoogleAuth()\ngauth.LocalWebserverAuth() # Creates local webserver and auto handles authentication.\n
Run Code Online (Sandbox Code Playgroud)\n

但没有到达任何地方。特别是,我得到了这个错误

\n
\n

错误 403:access_denied 开发人员尚未\xe2\x80\x99 授予您对此应用程序的访问权限。\xe2\x80\x99s 目前正在测试,\xe2\x80\x99 尚未经过\nGoogle 验证。如果您认为您应该有权访问,请联系开发人员

\n
\n

我是开发人员,我正在尝试将我的谷歌文件(实际上是图片)下载到我的本地驱动器。

\n

我感谢所有的支持。

\n

google-api python-3.x google-drive-api pydrive

3
推荐指数
1
解决办法
1751
查看次数

如何在应用程序脚本谷歌表中按列名称(标题)获取数据

如何在应用程序脚本中按列名称(标题)获取列值。我不想使用列索引/列号。我想使用标题检索整列数据。我尝试了多种方法但无法得到正确的解决方案。我正在使用 Google Sheet 应用程序脚本 JavaScript。

csv google-sheets google-apps-script

3
推荐指数
1
解决办法
7764
查看次数