3

My google sheets apps script has a doGet() function which takes an HTTP get request and parses the query parameters and puts them in a spreadsheet.

When I tested the app with a get request, I got a '500 Internal Error message', I then tested the deployment and got the error message ' Exception: Unexpected error while getting the method or property openById on object SpreadsheetApp. (line 9, file "Code") '.

So, it's having a problem opening the sheet but I am certain I have the correct sheet ID looking at project settings. I thought it could be a google drive issue so I made an entirely new google account with a blank drive and a new spreadsheet but the same error appears!? I'm not sure what's going on here, so any help would be much appreciated! Code below:

https://github.com/Conwon99/4th-Year-Project/blob/main/GoogleAppsScript

2
  • 2
    That spreadsheet ID looks quite long so I have doubts as to whether it is indeed correct. The IDs I'm familiar with are usually 44 characters. You could try using the openByUrl() method instead. Commented Jan 8, 2021 at 13:24
  • 1
    Thanks, was a bit of an idiot and used the Script ID.. new IDE got me confused slightly Commented Jan 8, 2021 at 15:53

1 Answer 1

5

As the comments indicate, the sheet ID in the code is not in the standard 44-character format thus error 500 was thrown by openById() method.

The solution is to use a valid file ID that points to a non-deleted Google Sheet.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.