Your time is important. In this example we'll show you how you can build a Calendar to Coda sync so you can do the following:
Pull stats out of your calendar
How much time are you spending in meetings? What types of meetings?
Who you are spending time with?
Make the most of the time you and your team spend in meetings by adding meaningful metadata:
Goals
Notes per meeting
Sentiment indicator
Follow ups
What you'll learn
How to access Google Calendar events from Google Apps Script
How to write calendar data into rows in a Coda table
Instructions
1. Setup
Here's a table you can use to store your events. We'll be using column names instead of IDs for simplicity, so be careful not to rename any columns, or your script will start failing (and you'll get failure notifications from Google).
ⓘ If you copy this table outside of this doc, you'll have to set the formula on the Day column to [Start Time].DateTimeTruncate('day') .
ⓘ You'll have to replace [email protected] with your desired calendar's ID. For your personal calendar, this is usually your email address. For other calendars, you can go to
, go into "Settings" via the hover menu for the calendar you're interested in within the left sidebar, and then use the "Calendar ID" that's in the "Integrate calendar" section.
CodaAPI.authenticate('abcd1234-efgh-5678-ijkl-1234mnop5678'); // Replace with your token.
/** Breaks up the array into smaller arrays of at most `chunkSize` length. */
function chunkArray(array, chunkSize) {
var output = [];
for (var i = 0; i < array.length; i += chunkSize) {
output.push(array.slice(i, i + chunkSize));
}
return output;
}
3. Get it working
With the script set up, run (▶) your syncGoogleCalendarEvents() function.
Since you're syncing a month's worth of data, the script may take a minute to run. If you'd like to see its progress, go to the script executions list using View→Execution Transcript. After a while, you should see your events trickle in.
You can now set up a trigger (
) to run syncGoogleCalendarEvents() periodically to sync your calendar events (see