If your preferred email client is not one of the popular choices, for example you use roundcube, Nextcloud or Snappy mail, you probably have come across a situation where email invitations to web meetings arrive as email attachments. What’s then most convenient is to be able to click on an attachment and have it automatically appear in Google’s calendar. This guide explains how to achieve this on a Linux desktop, as well as in Android.
The attachment is a file with an ICS or iCal extension is a set of meeting’s metadata. It is formatted and known as one of the MIME type files. This allows desktops to assign a handling application whenever such file is to be opened. For Android, the operation is easy, since there’s a Google calendar app either preinstalled or easily installed, which can be associated with the file (use the tripple-dot button on the file, then “Open with” and select the calendar app).
The challenge is a bit harder on the desktop, where there’s no Google app available. There usually are, depending on the choice of the desktop manager, calendar applications which could integrate with Google’s calendar, however that is not always the case. In such situations, there’s a good solution called gcalcli.
It can be easily installed in user mode with a few trivial steps (such as creating a python virtual environment). Since the Google Calendar is available through a RESTful API behind OAuth authentication, there is one prerequisite described in this guide. Following it allows gcalcli to securely call Google Calendar’s API to create events using the import command.
Eventually all that’s left to do is to write an oneliner script which can be tied to the desktop’s ICS MIME type, which will then run gcalcli with the right arguments and parameters. Here’s an example:
patryk@ryba ~ % cat gcal-venv/bin/importer.sh
#!/bin/zsh
#
/home/patryk/gcal-venv/bin/gcalcli --calendar='Patryk Rzadzinski' import ${1}
I use XFCE as my desktop manager, therefore my ICS file association looks like this:

And that’s all. Clicking on any file with the .ics extension will have my desktop call the importer.sh
script, which will invoke gcalcli from it’s venv
with the right parameters. Gcalcli will then call Google’s API to create the event will all the details as the inviter intended. Enjoy.