Google https://drive.google.com 的工作表宏错误请求失败返回代码 403
Google Sheets Macro Error Request failed for https://drive.google.com returned code 403
我从 运行 我的宏中收到以下错误消息:
异常:https://drive.google.com 请求失败返回代码 403。截断的服务器响应:抱歉...正文{ 字体系列:verdana、arial、...(使用 muteHttpExceptions 选项检查完整响应)
似乎在 URLFetchApp 函数处停止:
var ss2 = SpreadsheetApp.getActive();
var url2 = 'https://drive.google.com/uc?export=download&id=1H5B1JAJX7xfxOW8b4kgEs3C2eFphWuJQ';
var file2 = UrlFetchApp.fetch(url2); // get feed
var csv2 = file2.getBlob().getDataAsString();
var csvData2 = CSVToArray(csv2); // see below for CSVToArray function
var sheet2 = ss2.getSheetByName('playerData'); //Replace this with the sheetname you want the data to appear in
for (var i2 = 0, lenCsv2 = csvData2.length; i2 < lenCsv2; i2++) {
sheet2.getRange(i2 + 1, 1, 1, csvData2[i2].length).setValues(new Array(csvData2[i2]));
}
试试{muteHttpExceptions: true}
function myFunction() {
var ss2 = SpreadsheetApp.getActive();
var url2 = 'https://drive.google.com/uc?export=download&id=1H5B1JAJX7xfxOW8b4kgEs3C2eFphWuJQ';
var file2 = UrlFetchApp.fetch(url2, {muteHttpExceptions: true });
var csv2 = file2.getBlob().getDataAsString();
console.log(csv2)
}
有效!
我从 运行 我的宏中收到以下错误消息:
异常:https://drive.google.com 请求失败返回代码 403。截断的服务器响应:抱歉...正文{ 字体系列:verdana、arial、...(使用 muteHttpExceptions 选项检查完整响应)
似乎在 URLFetchApp 函数处停止:
var ss2 = SpreadsheetApp.getActive();
var url2 = 'https://drive.google.com/uc?export=download&id=1H5B1JAJX7xfxOW8b4kgEs3C2eFphWuJQ';
var file2 = UrlFetchApp.fetch(url2); // get feed
var csv2 = file2.getBlob().getDataAsString();
var csvData2 = CSVToArray(csv2); // see below for CSVToArray function
var sheet2 = ss2.getSheetByName('playerData'); //Replace this with the sheetname you want the data to appear in
for (var i2 = 0, lenCsv2 = csvData2.length; i2 < lenCsv2; i2++) {
sheet2.getRange(i2 + 1, 1, 1, csvData2[i2].length).setValues(new Array(csvData2[i2]));
}
试试{muteHttpExceptions: true}
function myFunction() {
var ss2 = SpreadsheetApp.getActive();
var url2 = 'https://drive.google.com/uc?export=download&id=1H5B1JAJX7xfxOW8b4kgEs3C2eFphWuJQ';
var file2 = UrlFetchApp.fetch(url2, {muteHttpExceptions: true });
var csv2 = file2.getBlob().getDataAsString();
console.log(csv2)
}
有效!