Service Spreadsheets failed while accessing document with id {someID}

927 views
Skip to first unread message

Juan David Paladines

unread,
May 24, 2021, 11:45:05 AM5/24/21
to Google Apps Script Community
Having in mind that the Spreadsheet has more than 20.000 rows with information in 5 different sheets.
Captura de pantalla 2021-05-24 104156.png
I'm trying to use this global variable, but it shows me that it has an error accessing to an unknown function in it... I don't know if there exist the same error in the other 4 variables similar to this one but with different name...

What could be the error?

Chanel Greco

unread,
May 25, 2021, 10:12:45 AM5/25/21
to Google Apps Script Community
Hi there

Here some possible error sources:
  • Do you have V8 runtime active? Without it you can't use constants als variable types (const wsBogota). Further information here: https://developers.google.com/apps-script/guides/v8-runtime?hl=en
  • What happens when you execute only the first method? Does SpreadsheetApp.getActiveSpreadsheet() work? If yes, then you know that the second method (.getSheetByName) is causing the error.
  • Are you positively sure that the sheet name you are passing in as a parameter to the getSheetByName method is spelled correctly?

Juan David Paladines

unread,
May 25, 2021, 10:34:34 AM5/25/21
to Google Apps Script Community
  • Yes, I do have the V8 runtime active.
  • When I run SpreadsheetApp.getActiveSpreadsheet(), it stays in the first sheet, it doesn't work when I'm in any other sheet different than the first.
  • It is spelled correctly, I copied the same name for multiple times

Juan David Paladines

unread,
May 25, 2021, 10:50:58 AM5/25/21
to Google Apps Script Community
In the second bullet, if I only run the method you said, it works perfectly, but I need to move between 5 different sheets, so that's why I'm using .getSheetByName()


On Tuesday, May 25, 2021 at 9:12:45 AM UTC-5 Chanel Greco wrote:

Chanel Greco

unread,
May 25, 2021, 11:59:00 AM5/25/21
to Google Apps Script Community
Ok, I suggest the following modification:
const spreadSheet = SpreadsheetApp.getActiveSpreadsheet();

const sheet1 = spreadSheet.getSheetByName('sheet1');
const sheet2 = spreadSheet.getSheetByName('sheet2');

Repeat for all the 5 sheets you have.

Does that work?

Reply all
Reply to author
Forward
0 new messages