Unexpected error while getting the method or property getSheetValues on object SpreadsheetApp.Sheet

6,196 views
Skip to first unread message

Manisha Sharma

unread,
Mar 21, 2022, 9:44:47 AM3/21/22
to Google Apps Script Community
While using openbyID() sheet functions using apps script facing Exception: Unexpected error while getting the method or property getSheetValues on object SpreadsheetApp.Sheet. 

had tried an alternate way by using openbyURL(), but that didn't work either
any help would be much appreciated.

Thank you 




Andrew Roberts

unread,
Mar 22, 2022, 6:46:57 AM3/22/22
to google-apps-sc...@googlegroups.com
You probably don't have access to that GSheet from that account.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/603df4a8-1941-4ed8-b943-fe0a2cc8502en%40googlegroups.com.

Edward Ulle

unread,
Mar 22, 2022, 7:55:16 AM3/22/22
to Google Apps Script Community
Just to be clear you are using

let spread = SpreadsheetApp.openById("xxxxx");
let sheet = spread.getSheetByName("name");
let values = sheet.getSheetValues(startRow, startColumn, numRows, numColumns);

Manisha Sharma

unread,
Mar 22, 2022, 8:15:40 AM3/22/22
to Google Apps Script Community
Yes, I am using the exact same way to interact with spreadsheets.

Also, I have ownership of the project as well as the sheet still, I am getting this error.

cool water

unread,
Mar 22, 2022, 8:35:15 AM3/22/22
to Google Apps Script Community
it looks like you are not referencing a Sheet object.  
SpreadsheetApp.openById("xxxxx"); return a SpreadsheetApp object 
SpreadsheetApp.openById("xxxxx") .getSheetByName("name");  return a Sheet object 
please check if your code are using getSheetValues method on a Sheet object
Reply all
Reply to author
Forward
0 new messages