0

I wish to use this sync process but it will duplicate the events if I do any changes or editing.
What should I do to avoid it?


function scheduleShifts() {
  /**
      Task 1) Open the Event Calendar.
  **/
  var spreadsheet = SpreadsheetApp.getActiveSheet();
  var calendarId = spreadsheet.getRange("C4").getValue();
  var eventCal = CalendarApp.getCalendarById(calendarId);

  /**
      Task 2) Pull each shift information into the code, in
      a form that the code can understand.
  **/
  var signups = spreadsheet.getRange("A8:C27").getValues();


  /**
      Task 3) Do the work!
  **/
  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);
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.