Blog
Calendar - An easy way to add events to Google calendar
November 22. 2021
For cases where we want to add events to a Google calendar, we can carry out this task through a simple technique that avoids the more complex alternative of calling the Google Calendar connector. This post describes this method in more detail.
For scheduling apps, a useful tip is that we can create a Google calendar event by calling a URL that initiates the creation of an event in a new Google calendar web browser window.
The key to this method is to compose an address in the format that looks like this:
https://www.google.com/calendar/render?
action=TEMPLATE&
text=EventTitle&
dates=20131206T050000Z/20131208T060000Z
&location=EventLocation&
details=EventBody
The above address opens Google calendar with the details that we specify through the parameters. The following link provides full details, including how to specify additional values such as recurrence and meeting attendees.
How to create a Google calendar event from a form.
To apply this technique in Power Apps, we compose a URL that matches the format above, and we open it by calling the launch function.
The example syntax would look like this:
The example syntax would look like this:
With(
{
Title:"Power Apps Meeting",
Body:"Meeting to discuss Power Apps",
StartDate:DateTimeValue("2021-11-22 13:00"),
EndDate:DateTimeValue("2021-11-22 13:30"),
EventLocation:"London"
},
Launch("https://www.google.com/calendar/render?action=TEMPLATE&text=" &
Title &
"&dates=" & Text(StartDate, UTC) & "/" &
Text(EndDate, UTC) &
"&location=" & EventLocation &
"&details=" & Body
)
)
- Specify time in the user's timezone: 20211122T193000/20211122T223000
- Specify time as UTC: 20211122T193000Z/20211122T223000Z
- Specify all-day events: 20211122/20211123
Note that if we want to specify the UTC time and if we attempt to convert a date from Power Apps by calling the Text function and specifying UTC, Power Apps adds hyphen and semicolon characters to the output. The Google implementation does not recognise UTC date times with these characters, therefore it would be necessary to strip these characters when we construct the URL.
When we now run this formula, Google calendar will open in a new window with pre-populated values, as shown in the screenshot beneath.
Conclusion
In cases where we want to add events to a Google calendar, we can accomplish this task by composing a URL that opens Google calendar with prefilled values and launching this URL from a Power Apps screen
- Categories:
Related posts