Build a Google Calendar Link
I recently created an event website and needed to create links for people to add the events to their calendars—the documentation for how to do this for Google Cloud is a mess, so here’s what I eventually worked out.
Start with: https://www.google.com/calendar/render?action=TEMPLATE
Now, each piece we’ll add is an additional parameter:
Title is specified as
text, so append that to the URL if you want that. For example, if I wanted the title to beWelcome, I would add&text=Welcome, e.g.:https://www.google.com/calendar/render?action=TEMPLATE&text=WelcomeDate/Time is next, starting with the keyword
dates. Here, we specify the date asYYYYMMDD(e.g., 1 July 2022 is20220701), and times are formatted asHHMMSS(e.g., 8:30 AM is083000). The date and time are separated with the letterT, and the start and end pieces are separated with/. For example, if theWelcomeevent starts at 8:30 AM on 1 July 2022 and ends at 10 AM, the value would be:20220701T083000/20220701T100000Timezone is optional—without it, you get GMT. If you want to specify a timezone, use
ctz, and the value is a tz database entry. For example, if you want South Africa, it would be:Africa/JohannesburgLocation is also optional and uses the key
locationwith free-form text. If we put the above example together, we get:https://www.google.com/calendar/render?action=TEMPLATE&text=Welcome&dates=20220701T083000/20220701T100000&ctz=Africa/Johannesburg&location=Boardroom
Notes:
- You must URL encode the values you use. For example, if you had a title of
Welcome Drinks, it would need to beWelcome%20Drinks. - There are other parameters (e.g., for descriptions) that I never used, so I don’t have them documented anymore.