Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9712

Avoid Duplicate Events in Auto Sync Google Sheets to Google Calendar

$
0
0

I wish to use this sync process but it will duplicate the events if I do any changes or editing. How 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);
  }
}

Viewing all articles
Browse latest Browse all 9712

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>