🗓️ Calendar Agenda and API Demos

by Fran T

Version 9 (May 10, 2022)

Download (165 downloads)

Displays your agenda for your choice of calendars and range of dates.

Despite the ease of use of the Automate Calendar blocks, there are inconsistencies in Google's internal API that result in it being very tricky to get your events correctly. All-day events cause special difficulty, which we delve into in this Forum thread:

https://groups.google.com/forum/m/#!topic/automate-user/JfGZl5gLoFY

Some things to watch out for:

o All-day events that start on the following day are returned within the window of the current day and must be filtered out, first converting their beginning and ending times to the GMT (UTC) time zone
o All-day events that start on the current day are not found, requiring the GMT offset be subtracted from the midnight time in order to be detected
o All-day anniversary events are defined having both starting and ending times of midnight on the same date
o The beginning and ending times in the Has Event block are both inclusive and have one-second resolution, so the number of seconds in a day since midnight *minus one* (86399) must be used for the ending date to return results only for the current day
o Care must be taken not to inappropriately filter out multiday events or single events which span dates

In light of all these issues, I originally wrote this flow as a demo to figure out the best way to resolve them in my flows. It's written so that the critical logic is contained in a subroutine to make it easier to copy into your own flows. The subroutine returns the past, upcoming, and ongoing event counts, the starting and ending times of the agenda, and the agenda itself, which is a dictionary that maps the midnight time of each day to an array of the day's events from all of the selected calendars. To set up the subroutine, give it a variable called 'calendars', which is a dictionary of calendar URI keys mapped to calendar names. You can create that dictionary using the "Calendar Picker" subroutine, which also demonstrates how to do a content query to get calendar information.

--------------
Updates:
o Add Advanced Notice feature to optionally check past today's date by a given duration
o Work around another framework bug where all-day events are not detected for the current day; improve support for events which span days; allow multiple calendars to be chosen; rewrite user experience to be a standalone app which displays the agenda based on the number of days and calendars the user selects
o Fix bug with events spanning full days; denote today and past events; let the user decide whether to show past events; deduplicate all-day events from different calendars

5.0 average rating from 2 reviews

5 stars
2
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.