I have the code here at the top of a Google Apps Script that is container-bound to a Google Sheet file:
function onOpen() { var ui = SpreadsheetApp.getUi(); ui.createMenu('Payroll') .addItem('Add shoot days', 'copyCallSheets') .addItem('Update Call Sheet/Crew List', 'updateDocs') .addItem('Create Daily Time Sheet', 'sendDailyTimeSheets') .addItem('Collect Out Times from DTS', 'collectOuttimez') .addItem('Process Timecards', 'processTimecardz') .addSeparator() .addItem('Report Issue', 'sendErrorReport') .addToUi(); }
When I open my file, however, the onOpen()
simple trigger fails, and I get this error message:
Exception: You do not have permission to call DriveApp.getFileById. Required permissions: (https://www.googleapis.com/auth/drive.readonly || https://www.googleapis.com/auth/drive) at unknown function
Any of the functions I'm calling in the menu work just fine if I call them by manually executing them in the script, but I want to be able to have the user call them from the UI.
Here is a screenshot of the error:
https://stackoverflow.com/questions/67038943/onopen-not-working-getting-permissions-error April 11, 2021 at 04:29AM
没有评论:
发表评论