There are multiple way to work with Google Calendar.
I choose to not work with the private key thing for now.
Instead I will try to use the option working with the .ics
format.
This should give a relatively universal solution for all kind of calendars.
I don’t want a locked-in solution that would work only for Google.
(Not that this would very surprising if in the end we find out we have to do something custom because it’s google)
ICS files
Google offer a private URL you can use to access your calendar read only.
In your Setting > Settings for my calendars > Calendar Name > Integrate calendar
Unhide the stars and you will get the secret address of your ical file for your calendar.
This can then be parsed into an org file using the following script.
https://github.com/msherry/ical2org/blob/master/ical2org.awk
It does require awk
installed on your machine, but this is quite standard, so not a problem.
somehow would be nice to re-write this using python or go, but it’s left as an exercise to the reader.
The logic is quite simple:
- download the ics file
- convert to org
- do this every 15 min in a cron
|
|
In order to help with the setup I have written a quick install script
|
|
It requires you to have a .local/
folder, with bin
and share
it is quite common on linux install, but feel free to modify it to fit your local thing.
Why read-only ?
One thing I want to get out of the way is the reason why I am not looking for a bi-directional synchronisation.
There are ways to do sync google calendar both way with org-agenda, if you are into that sort of things.
But I decided not to.
The reason is quite simple.
Org mode is the ground zero, where the work is happening.
It is a very dynamic and flexible environment.
Google calendar on the other hand is a dedicated to just one aspect of the workflow, and I don’t want to limit myself in org-mode just so that I can synch back.
All in all, I don’t have that many event, and usually adding events happen directly into the calendar.
So if I am not gonna need it, I prefer to avoid it. Less bugs and problems to fix.
Source
I have put all the source code for this little project in here
Have fun.