At present, this script WILL NOT WORK, as it relies on the CPAN module Net::Google::Calendar which (at time of writing) uses an older API version which Google no longer support.
To get this working, either Net::Google::Calendar needs updating to use their newer API, or this script needs to be switched to using Net::Google::CalendarV3 but I don't think it's a straightforward drop-in replacement, and I haven't had time to do it (I no longer use this script myself. However, pull requests welcome!)
A simple Perl script to parse an iCal-format (.ics) file, and update a Google Calendar with it, via the Google Calendar API.
Why not just add the iCal feed URL to Google Calendar and let them handle it?
Because they update horribly slowly (expect about once every 24 hours).
Calendaring is a time-sensitive thing; I don't want to wait a full day for updates to take effect (by the time Google re-fetch the feed and update my calendar, it could be too late!).
The script will read your Google account details from ~/.netrc
, where you should specify them as e.g.:
machine calendar.google.com
login yourgoogleusername
password supersecretpassword
Of course, you'll want to ensure that file is well protected.
./ical-to-gcal --calendar 'Calendar Name' --ical_url ical_url
The script will fetch the iCal calendar feed, then for each event in it, add/update an event in your Google Calendar (the ID from the iCal feed is added in the extra data of the event in the Google Calendar, so the script can match them up next time).
The calendar name you provide must already exist in your Google Calendar account.
The script adds a tag to each event's content to store the UID of the event imported from the iCal feed so that events can be updated in future, or deleted if they are no longer present in the source iCal feed. If you remove this tag from an event, a new (duplicate) event will be created next time the script runs (and the old event will be "orphaned") - so don't do that.
David Precious <davidp@preshweb.co.uk>