简体   繁体   中英

gas spreadsheet authorization

I'm new to goole apps script. I have created a simple test script and I would like to open a spreadsheet and read some information. My script is authorised, I published it with:

  • Execute the app as: me
  • Who has access to the app: Anyone, even anonymous

I can open the spreadsheet manually from drive so I have access to it. But when I run the script it shows me: " Authorisation is required to perform that action. " Here is the script:

function doGet(e) {

   var doc = SpreadsheetApp.openById("0AvQ4qcr20AT2dHBDRm5QYzFqTkdyNk9jU3hRUDFoakE"); 

   return ContentService.createTextOutput( doc.getName());
}

Do I need to make some additional authorisation using oauth or something like this ? If so I would appreciate if I get any example.

You have to run the doGet function - or any other function in the same project - just once from the script editor before you can use the webapp.

This will trigger the authorization process (showing one or more popups depending on the services you use in that project) and is a necessary step.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM