Pulling in data from Google Calendar

Yeah, you have that mostly right. The GoogleCalendar::Events formula returns a list of events- you can see that if you try that formula directly in the canvas. Then the FormulaMap takes in the list of events, and lets you do something for each individual event. CurrentValue is the way of referencing the individual event being processed. So in this case the AddOrModifiedRows action will be run once for each event, and each time it’s run, CurrentValue will be equal to a different one of the events. Does that help clarify a little?

Anyway, dug more into why that formula isn’t working. It seems we have a bug in our formula engine that’s preventing currentValue.Id from working within an AddOrModifyRows formula. Hope we can fix that soon. For now I think you can match on URL instead of ID since that should be a unique identifier as well.

I got something working to pull events into my google calendar like this:

The formula is
FormulaMap(GoogleCalendar::Events([gil@coda.io], calendar: 'Coda Calendar', minDate: Today(), maxDate: Today() + 2), CurrentValue.Url).FormulaMap(AddOrModifyRows([Calendar events], Url=CurrentValue, Url, CurrentValue))

Two changes here. First of all the move from ID -> URL for both insertion and matching. Secondly I’m actually dropping the URL into its own column called URL. I then have an Event column with a formula of ‘=[Url]’ to pull in that URL and load the full event. That makes sure that I can safely match on the URL column to avoid duplicate rows.

Hope that helps. Happy to share that doc with you as well if you send me your email :slight_smile:

3 Likes