I have a Google Apps Script function, push_permissions()
, that reads permissions from a Spreadsheet and applies them to Google Drive files and folders. The function works as expected when manually run, but I wanted to automatically trigger this function every time edits are made on a certain range. So I made this onEdit()
function:
function onEdit(e) {
if (e.range.columnStart == 10 && e.range.rowStart > 2 && e.value.includes('@gmail.com')) push_permissions();
};
Whenever onEdit()
is triggered, it throws this error:
Exception: You do not have permission to call SpreadsheetApp.openByUrl. Required permissions: https://www.googleapis.com/auth/spreadsheets
at onEdit(Permissions:2:27)
Any way to make this work?