I created a script in the script editor, published it as a \"Deploy as API executable\". Inside this script, I provided a doc_id to my sheet and defined a function to get da
I had the same problem of permissions and I solved it by changing the status of my google sheet to public. Now I can read data using GET method
Even with everything okay, you can get that error by "devMode":true
.
Thanks to this, I wasted half a day when I tried to deploy for other users.
Just for the future reference.
I've also faced with the error and everything were associated accordantly... After some time of investigation I found out that sheet should be shared by link. This is a limitation of googleapis v4.
Make sure the app script is associated with correct dev console project.
The script should be associated with the dev console project id that corresponds with OAuth 2.0 client ID used (this dev console project should also have "Apps Script Execution API" enabled).
To change the developer console project for an app script select the following menu item: Resources > Developer Console Project...
On this screen enter the project number for your dev console.
I did a mix of all of your suggestions, plus I needed to use the non 'obsolete' ID of the Project. When I publish the script, it gives me an ID, which I was using succesfully as long as owner runs the routine, and only within Google Chrome (If I try it on Edge it fails). When I publish and try it with a different user it stop working. I open the script, go to file / Project properties and copy the longer Script ID instead. The routine start working for any user then. In the following image I underscore in red the key that Works for developer alone, and in Green the key that Works for all users (they're cutted in purpouse, and my environment is in spanish so actual translated options may vary, sorry)
I believe it is worth to make a summary:
Basically, these are all the required steps I needed to follow in order to get the script up and running. Hope it helps. Finally I would like you to see what I saw when it failed and when it succeeded:
Thank you!
You just have to add the service account user as an editor on the project
The email from the service account to add looks something like this
{project-name}@{project-name}.iam.gserviceaccount.com