Home GitHub Patreon
Discussions RSS Twitter

Org mode and google calendar sync

As a contractor working for multiple clients I juggle many projects and meetings all the time. Fortunately for me, there is orgmode. Unfortunately, my clients have not yet learned to appreciate its merits. Fortunately though, they all use the GSuite platform from Google, which means agendas are planned in Google Calendars.

So I finally bit the bullet and decided to integrate Google Calendar into my org agenda. I didn't have to go a long way before finding org-gcal.el.

My setup is taken mostly from Using Emacs - 26 - Google Calendar, Org Agenda by the amazing Mike Zamansky. One difference from Mike's setup is that I'm using a single-way sync only, that is I only fetch from google calendar and do not publish anything.

The reason is that I use multiple calendars (I basically have a google account at every company I work for plus a personal calendar) and the workflow with events and inviting myself from one calendar to another as attendees is too complex and fragile to trust some automated tool. And I can not afford my calendars to break.

(use-package org-gcal
  :after org
  (setq org-gcal-client-id "781554523097-ocjovnfpqgtpoc4qv7ubr8c679t96bv7.apps.googleusercontent.com"
        org-gcal-client-secret "<<gcal-secret>>"
        org-gcal-file-alist '(("matus.goljer@gmail.com" . "~/org/gcal.org"))
        org-gcal-header-alist '(("matus.goljer@gmail.com" . "#+PROPERTY: TIMELINE_FACE \"pink\"\n"))
        org-gcal-auto-archive nil
        org-gcal-notify-p nil)

  (add-hook 'org-agenda-mode-hook 'org-gcal-fetch)
  (add-hook 'org-capture-after-finalize-hook 'org-gcal-fetch))

I'm also using org-timeline so I add some extra header arguments to the generated file to add a different color to the Google Calendar entries.

Published at: 2019-02-02 13:54 Last updated at: 2023-02-08 16:00
Found a typo? Edit on GitHub!