Data - How to save and retrieve Google calendar entries

The ability to access Google calendar entries can be very useful, particularly for organisations that use GSuite, or cases where app builders want to provide an easy way to retrieve, access, or to sync records from an Android device.

In this post, we'll walk through the syntax that enables us to manage Google calendar entries.

Introduction to connector

To use this connector in a canvas app, the first step is to add a connection through the data panel.


The Google Calendar connector offers a range of features, including actions to:

  • Show a list of available calendars
  • List the calendar entries for a specific calendar
  • Add, delete, and retrieve calendar entries
  • Update a calendar entry
For further details, the full documentation for this connector is here:

Retrieving a list of available calendars

Calendar entries are stored in calendars, and we can retrieve a list of available calendars by calling the ListCalendars action.

GoogleCalendar.ListCalendars().items
The screenshot beneath shows the output when we set the items property of a data table control to this formula.

A key value that this action returns is the id for each calendar. This defines the unique identifier for the calendar, and we require this to show the calendar entries for a specific calendar.


Retrieving/Searching calendar entries

To retrieve the calendar entries for a specific calendar, we call the ListEvents action. This action requires a calendar ID. The formula beneath highlights the simple use of this action. Here, we provide the ID of the selected calendar from the data table of available calendars.

GoogleCalendar.ListEvents(dtGoogleCalendars.Selected.id).items
To support the more typical case where we want to return calendar entries that match a specific range of dates, or contain a specific search phrase, we can use the syntax that's shown beneath:

GoogleCalendar.ListEvents(
dtGoogleCalendars.Selected.id,
{timeMin:Text(DateAdd(Now(), -2, Months), DateTimeFormat.UTC),
timeMax:Text(Now(), DateTimeFormat.UTC),
q:"project catchup"
}
).items

This formula returns all calendar entries from the past two months that contain the phrase "project catchup" in any of the fields.

We must specify the from and to datetime values (timeMin and timeMax) in UTC format. UTC format looks like this - yyyy-MM-ddTHH:mm:ss.fffZ (2016-07-20T08:00:00.000Z).

The q parameter specifies the search text query, and we can omit this if we want to return all records.

The screenshot beneath shows the output when we set the items property of a data table control to the ListEvents action.


This highlights the existance of an id value that uniquely identifies each event. We can pass this to the UpdateEvent, DeleteEvent, and GetEvent actions.

Other calendar attributes that we can access include description, summary, start, end, created (ie, the create date/time), attendees, htmlLink, location, organiser, status, and updated (ie, the updated date/time).

Creating a Calander Entry

The formula to create a calendar entry looks like this:

GoogleCalendar.CreateEvent(
dtGoogleCalendars.Selected.id,
"2021-03-11 23:00",
"2021-03-11 23:15",
{
description: "description value",
location: "location value",
attendees: "[email protected]",
status: "status value",
isAllDay: false
}
)
The first 3 mandatory arguments are the target calendar ID, the start time for the event, and the end time of the event.

The 4th argument specifies a record with additional event details. The fields in this record include:

  • description - the description of the event.
  • location - free-form text that describes the geographic location of the event.
  • attendees - a comma-separated list of attendee emails.
  • status - the 3 acceptable values are "confirmed", "tentative", or "cancelled".
  • IsAddDay - a true/false value to indidcate if this is an all-day event.

Updating a calander entry

The formula to update a calendar entry looks like this:

GoogleCalendar.UpdateEvent(
dtGoogleCalendars.Selected.id,
dtCalendarEvents.Selected.id,
{
start:"2021-03-11 23:00",
end:"2021-03-11 23:10",
description: "project catchup updated",
location: "location value",
attendees: "[email protected]",
status: "confirmed",
isAllDay: false
}
)
The first 2 mandatory arguments are the target calendar ID, and the target event ID. Just like the CreateEvent action, the final argument specifies a record that contains the calendar details to update.

Deleting a calander entry

The formula to delete a calendar entry looks like this:

GoogleCalendar.DeleteEvent(
dtGoogleCalendars.Selected.id,
dtCalendarEvents.Selected.id
)
The 2 mandatory arguments are the target calendar ID, and the target event ID.

Conclusion

Power Apps provides a Google calander connector that we can use to show a list of available calendars, and to add, delete, update, and retrieve events from calendars. This post highlighted the formulas that enable us to carry out these tasks.

Related posts

Data - How to remove trailing comma all rows in a table
February 20, 2025
Data - How to find the common rows from 3 or more collections
October 06, 2024
Data - How to show the distinct rows from 2 data sources or collections
February 26, 2024
Data - How to implement circular rotational date sorting
February 21, 2024
Bug - What to do when the data section of the Power Apps Maker portal doesn't work
June 18, 2023
Data - Combine columns from separate tables into a single table
October 13, 2022
Formula - Transposing/converting rows to columns- an almost impossible task?
September 23, 2021
Data - How to rename field names in a record
July 14, 2021
Data - How to hide duplicate rows in a gallery / show distinct multiple columns in a gallery
July 09, 2021
Data - Retrieving news/forum/blog articles with RSS
June 26, 2021
Data - How to sort by partial numbers in a text field
June 23, 2021
Data - How to return the last record from a table
June 19, 2021
Data - How to create bulk test/dummy records with random values
June 18, 2021
Data - 3 things you should know before using the MySQL or PostgreSQL connectors
May 11, 2021
Data - A walkthrough of how to migrate the data source of an app from Excel to Sharepoint
April 26, 2021
Data - How to enforce unique values (or prevent duplicate values) in one or more columns
April 19, 2021
Data - How much mobile data does Power Apps consume? What ways can we minimise this?
March 28, 2021
Data - How to save and retrieve Google contacts
March 10, 2021
SQL - Caution! This is how users can hack shared SQL connections
January 23, 2021
SharePoint – 2 Mistakes to avoid when importing Excel data
January 10, 2021
SQL - Don't let this DateTime bug catch you out!
January 05, 2021
Settings - What's the purpose of the "Explicit Column Selection" Setting?
January 04, 2021
SQL Server for Beginners Part 3 - Installing On-Premises Gateway
January 24, 2019
SQL Server for Beginners Part 2 - Installing Management Studio
January 14, 2019
SQL Server for Beginners Part 1 - Installing SQL Server
January 04, 2019
Searching data–What you need to know about case sensitivity
December 27, 2018
Images - How to create images that can change depending on data
November 09, 2018
Excel - Reasons NOT to use Excel as a data source
September 25, 2018
SharePoint - What you need to know about Filtering Data
September 16, 2018
Formulas - Generating Row Numbers
April 05, 2018