Google Calendar – Automatically Forward Events to Another Calendar

google-calendar

I run a seminar series at work. Due to institutional inertia, people find out about these seminars using three separate Google Calendars and are unwilling to either all settle on one or to subscribe to multiple. Currently, I have to copy events from one calendar to the other two manually. Is there any way to automatically forward the contents of one calendar to another? That way I could have one Google Calendar for the seminars, and the other calendars would automatically be updated.

Best Answer

There is no concept of forwarding events in Google Calendar. Subscribing to multiple calendars is how people normally deal with this.

But I can offer a Google Apps Script which copies all events within the coming week from source calendar to target calendar. It can be set up with a trigger to run every week, e.g., on Sunday. The calendar Id is found on the Settings page of a calendar.

function copyLastDayEvents() {
  var source = CalendarApp.getCalendarById('....com'); 
  var target = CalendarApp.getCalendarById('....com'); 
  var startPeriod = new Date();        // now
  var endPeriod = new Date();
  endPeriod.setDate(a.getDate() + 7);   // 7 days from now
  var events = source.getEvents(startPeriod, endPeriod);
  for (var i = 0; i < events.length; i++) { 
    var event = events[i];
    var title = event.getTitle();
    if (event.isAllDayEvent()) {
      cal.createAllDayEvent(title, event.getAllDayStartDate());
    }
    else {
      cal.createEvent(title, event.getStartTime(), event.getEndTime());     
    }
    Utilities.sleep(100);    
  }
}

This just loops over the events happening within the coming week, and copies them one by one. Utilities.sleep(100) provides a little pause (100 ms) to avoid hitting Google's rate limit for event creation.

This may be unsatisfactory for several reasons: e.g., events do not appear in the target calendar until the week before. Unfortunately it appears impossible to get all events created today (or within some time period); it's all based on when the events take place.

Related Topic