So I wrote a few custom functions for a spreadsheet I've been working on to streamline the process of entering and updating data. All the functions work perfectly fine in their current state, but I then wanted to set up some triggers such that the functions refresh on every edit. Because of this, I had to change some of my code from SpreadsheetApp.getActiveSpreadsheet()
to something like SpreadsheetApp.openById(spreadsheetidhere)
, as trying to retrieve the active spreadsheet doesn't seem to work with on edit triggers. This gave me the following error:
Exception: You do not have permission to call SpreadsheetApp.openById. Required permissions: https://www.googleapis.com/auth/spreadsheets (line 80).
I then added the proper permissions to the appscript.json manifest file - it currently has "oauthScopes": ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/spreadsheets"]
. These permissions have clearly been applied to my project file, as I was prompted to provide authorization and it is also
clearly displayed on the Overview page. Despite this, I am still receiving the exact same error every time, as if I never granted the permissions at all.
If anyone can tell me a workaround or fix, or even just a way to make the triggers work with SpreadsheetApp.getActiveSpreadsheet()
, that would be greatly appreciated!