New to any form of coding. I am trying to sync Google calendars to Google sheets to autogenerate events. I found this script online but continue to have errors. This is my current code:
function scheduleShifts() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarID = spreadsheet.getRange("C4").getValue();
var eventCal = CalendarApp.getCalendarById(calendarId);
var signups = spreadsheet.getRange("A8:C20").getValues();
for (x=0; x<signups.length;x++){
var shift = signups[x];
var startTime = shift[0];
var endTime = shift[1];
var volunteer= shift[2];
eventCal.createEvent(volunteer, startTime, endTime);
}
}
The error code I keep getting is:
ReferenceError: calendarId is not defined
scheduleShifts @ Code.gs:4
I can't seem to figure out how to correct it. Any suggestions? Thanks!