I’ve been trying to get a script from Apps Script to work with a specific Google Sheets whenever a certain column cell is changed, but for some reason, the script just returns "Exception: The script does not have permission to perform that action. Required permissions: (https://www.googleapis.com/auth/calendar || https://www.googleapis.com/auth/calendar.readonly || https://www.google.com/calendar/feeds)"
whenever said cells are changed.
I tried adding "oauthScopes": ["https://www.googleapis.com/auth/calendar"]
to my appsscript.json file, and I made sure that I and everyone else of whom the Google Sheet is shared with has access to the calendar that is being modified. Neither have worked so far. With that, here’s the code (with major simplification):
function onEdit(e) {
if (e!=undefined) {
if (e.range.getColumn()>25) {
let eventRow = e.range.getRow();
let mySheet = e.range.getSheet();
let myData = mySheet.getSheetValues(eventRow,1,1,29)[0];
if (dt.sendInviteStatus) {
CalendarApp.getCalendarById ("[email protected]").createEvent(
dt.eventName+" at "+dt.location,
"Thu Aug 01 2024 00:00:00 GMT-0400 (Eastern Daylight Time)",
"Thu Aug 01 2024 00:01:00 GMT-0400 (Eastern Daylight Time)"
);
}
}
}
}
Charlie Davis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.