Creating and updating entire Google Calendar from Coda Data

I would like to have:

  • A Google calendar.
  • Shared with many users.
  • Where all events on the calendar come from a Coda document.
  • When I change the Coda document, the Google calendar is updated (manually or automatically).

I have figured out how to use a button to generate an event from a table row. Then, I use another button to press all buttons in the table, generating the events.

The problem: When I change a bunch of rows in Coda and want to update the Google calendar, I first need to clear all old calendar entries. How do I do this?

I have even tried doing so from Google, but as far as I can tell their only answer is to delete and recreate the entire calendar. This will not work as it is a shared calendar and all users would lose access.

Ideas?

Thanks in advance for any help!

After digging around some more, I found an option using Google Scripts:

WARNING: This deletes all events on the calendar you specify, so be careful!!!

  1. Go to script.google.com.

  2. Create a new project and paste in this code:

    function clearCalendar() {
        var calendarName = 'Test Calendar';
        var calendar = CalendarApp.getCalendarsByName(calendarName)[0];
        var events = calendar.getEvents(new Date(2000,0,0,0,0,0), new Date(2500,0,0,0,0,0));
        for(var i=0; i<events.length;i++){
          var ev = events[i];
          Logger.log(ev.getTitle()); // show event name in log
          ev.deleteEvent();
        }
    }
    
  3. Save it and run it.

If anyone knows a way to do this in Coda, please do let us know!

Hi @Eric_Hewitt,

Welcome to the Coda Community!

You can update entries in the calendar pack as well. There isn’t a feature to delete an entry, but most people don’t want to delete entries anyway.

Here’s a quick template that uses the Create and Update buttons. Note that the “Result” field for both buttons uses the same column. Each time you update the event, you need to overwrite the result there.