Skip to content Skip to sidebar Skip to footer

How To Import Data From Another Google Sheet Using Google Script Without Using Spreadsheet Id (july 2020 Update Stopped My Code Working)

I previous asked on Stack Overflow how I could import data from another Google Sheet using Google Script without using Spreadsheet ID. Previous question and the answers, to which w

Solution 1:

IMHO it's not a good idea to use Google Apps Script calls in the global scope. As you are already facing, the problems with the current calls in your script make other functions to not work.

First thing that you have to do is to move those lines from the global scope to another place. You might put them inside a try...catch, on it's own function or inside of importData1() function declaration.

Regarding the specific error about line 2:

var file = folder.getFilesByName("SOURCE FILE NAME").next();

it means that the code can't find a file named SOURCE FILE NAME inside the folder. Maybe the file name was changed or the effective user doesn't have access to file. If running the code in incognito mode works, then the problem is that the user running the code has being signed-in in multiple Google accounts.

Post a Comment for "How To Import Data From Another Google Sheet Using Google Script Without Using Spreadsheet Id (july 2020 Update Stopped My Code Working)"