how to automatically add a schedule from Google Sheets into Calendar?

how to automatically add a schedule from Google Sheets into Calendar without create a duplicate event? Is there a way to run daily automatically?

I tried this code... it works partially. "spreadsheet.getRangeList(rangeList).setValue("done");" does not works and my CL column stay avoid. Some one have an idea?

function scheduleShifts() {
var statusColumn = "CL"; // As a sample, this script uses the column "CL".
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = spreadsheet.getRange("Dados!CJ3").getValue();
var eventCal = CalendarApp.getCalendarById(calendarId);
var signups = spreadsheet.getRange("Dados!CI5:CL3500").getValues();
var rangeList = [];
for (x = 0; x < signups.length; x++) {
var shift = signups[x];
if (shift[3] == "done") continue;
rangeList.push(statusColumn + (x + 5));
var startTime = new Date(shift[0]);
var endTime = new Date(shift[1]);
var volunteer = shift[2];
eventCal.createEvent(volunteer, startTime, endTime);
Utilities.sleep(300)
}
spreadsheet.getRangeList(rangeList).setValue("done");
}

3 REPLIES 3

@Joseph_Seddik Do you have idea how to solve this issue?

Steve
Platinum 4
Platinum 4

How is this related to AppSheet?

Sorry, Steve. I am integrating the google calendar to the appsheet... This issue is not directly related, but i ask here because maybe someone know the answer.

Top Labels in this Space