I'm getting the following error message from running my macro:
Exception: Request failed for https://drive.google.com returned code 403. Truncated server response: Sorry... body { font-family: verdana, arial, ... (use muteHttpExceptions option to examine full response)
Seems to be stopping at the URLFetchApp function:
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]));
}
Try with {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)
}
it works !