How to get the correct permissions for SpreadsheetApp.openById

Viewed 6198

I have a Google sheets file where I have created a bound script. The script does a quick web query, pulls and parses some data, and then updates the sheet with the new data.

I can run it with the sheets file open easily enough, and everything works as planned. I want to switch it over to running on a daily timer. To make sure I'm working with the correct sheet, I changed:

var spreadsheet = SpreadsheetApp.getActive();

to

var spreadsheet = SpreadsheetApp.openById('MyProjectID');

Unfortunately, when I run the script now, I get the following:

You do not have permission to call SpreadsheetApp.openById. Required 
permissions: https://www.googleapis.com/auth/spreadsheets (line 6, file 
"macros")

My understanding is that openById requires certain permissions. How can I authorize the script to get those permissions? At this time, I'm just running this personally, so it doesn't need to be deployed to the world at large.

0 Answers
Related