Sync Org-mode Agenda to Calendar Apps


I have been using org-mode for several years. One of the advantages of org-mode is it’s flexibility to synchronize todo events with calendar apps. Let me share my experience.

Calendar apps like Google Calendar and iCloud Calendar are necessary to a lot of people. Many org-mode newbies may wonder how can they sync todo events with these calendar apps, so that they can receive notifications on mobile phone, visualize agenda in a calendar app, or share calendar with friends. I want these features too.

Using MobileOrg

At first, I used MobileOrg android app to sync agenda to calendar. MobileOrg was a great app. It can sync agenda events to mobile phone’s system calendar. So I added Google Calendar account to my mobile phone’s system calendar and synced org-mode agenda from Emacs to MobileOrg, then my agenda would be automatically synced to Google Calendar by MobileOrg. But, as you know, the MobileOrg android project has been abandoned for several years. It turns ancient and ugly by today’s modern design standards. So finally I uninstalled this app from my mobile phone. I still miss it. I known the MobileOrg for iOS is still under active maintenance but I don’t own an iPhone. You may want to try that out if you are interested and own a non-free iPhone.

Using org-caldav

Then I switched to org-caldav. org-caldav supports two-way synchronization between org-mode files and caldav server. That means you can not only synchronize events from an org-mode file to a calendar but also synchronize from a calendar to an org-mode file. Cool! I happily used org-caldav to synchronize my org-mode agenda with Google Calendar for several years. It worked great. The only downside is that the synchronization process is slow.

During these years, I also actively looked for alternative solutions. For example, I tried org-gcal when it appeared on GitHub. But the experience wasn’t good. I tried it two or three times later in the hope that it may become better but still got disappointed. Nothing else can compete with org-caldav.

Using org-export

About two years ago, I abandoned org-caldav, not because it failed me, but because I don’t want to manually run org-caldav every time I modify my org-mode files. I knew that can be solved by running org-caldav as a cron job, but I simply disliked it. I wanted a faster and cleaner solution and I finally found one.

My new solution is very simple:

  1. Tell Emacs to export my org-mode agenda to an iCalendar file. Put this iCalendar file in Dropbox so that it can be automatically synced.
  2. Create a share link for this file in Dropbox.
  3. Import this link to Google Calendar. Then this calendar shows up in Google Calendar.

Let me explain in detail. Org-mode is very powerful. You can export scheduled events in an org-mode file to an iCalendar file by executing org-icalendar-export-to-ics . To automatically do this, I append this code snippet to my org-mode file:

Local Variables:
eval: (add-hook 'after-save-hook 'org-icalendar-export-to-ics nil t)

This will trigger Emacs to export events in this org-mode file to an iCalendar file every time this file is saved. If you store todo events in several org-mode files and want to combine these events into one iCalendar file, you may want to replace org-icalendar-export-to-ics with org-icalendar-combine-agenda-files. Please have a look at their doc strings.

Then you should share this iCalendar file from Dropbox. Choose “Anyone with the link can view this file”, and you will get a link in the format of . Please change the suffix from “?dl=0” to “?dl=1”. “?dl=1” means directly download the file rather than preview the file in a web page.

Finally, you can add this share link to your prefered calendar applications. Many calendar applications support adding external iCalendar file from a URL. The process1 for Google Calendar is:

  1. On your computer, open Google Calendar.
  2. On the left, above “My Calendars,” click Add and then From URL.
  3. Enter the calendar’s address in the field provided. The address needs to be an ICAL link.
  4. Click Add Calendar. The calendar will appear on the left side under “Other calendars.”

Voila! Now your org-mode agenda is automatically sync to Google Calendar. The only disadvantage compared to org-caldav is that this is one way sync, which means you can not sync events from calendar to org-mode files. But I always organize my agenda within Emacs, so a read only calendar is enough for me. This is way more fast and clean without the necessasity to install any third-party packages and configure caldav accounts and micellaneous parameters. You may prefer this solution too.

  1. ↩︎



Porting Rime Input Method Engine to Guix