google-calendar-apiicalendarvcalendar

Google Calendar .ics import Standards


I have a .ics file that I generate from our database that works correctly in iCal, but is flaky in Google Calendar. Sometimes Google Calendar will import the file, but it does not pick up all the events.

Does anyone have any tips on the REQUIRED fields that Google needs? I am at a loss here as to why sometimes it won't import, or why it doesn't like some events. Some days we have 3 events, but Google only shows 1.

Searching elsewhere online does not really help, as it seems most other people are having this same issue.

Here is a sample of my formatting:

BEGIN:VCALENDAR
METHOD:PUBLISH
X-WR-TIMEZONE:America/Los_Angeles
CALSCALE:GREGORIAN
VERSION:2.0
PRODID:-//PUC Calendar// v2.0//EN
BEGIN:VEVENT
UID:31754826317
TZID:America/Los_Angeles
DTSTART:20091001T100000
URL;VALUE=URI:http://www.puc.edu/news/calendar/events/dates/colloquy-dr-knight
DTSTAMP:20091001T100000
SUMMARY:Colloquy: Heather Knight
DTEND:20091001T100000
LOCATION:Sanctuary
END:VEVENT
END:VCALENDAR

Our .ics file URL is: http://www.puc.edu/news/calendar/puc.ics


Solution

  • Your TZID looks incorrectly placed. You should be including them in the DTSTART and DTEND lines like this:

    DTSTART;TZID=Pacific/Honolulu:20110628T140000
    DTEND;TZID=Pacific/Honolulu:20110628T140000
    

    (Be aware: leave 'Z' 's off the end of timestamps unless your time is Zulu time = GMT)

    You should add a SEQUENCE:xxx where xxx is a number that increments each time the ics is updated. E.g.

    SEQUENCE:0
    

    I did manage to get this to work (it's quirky) and had the same issue with only single events from my multiple event ics file getting imported. The best trick (alluded to elsewhere) is to get an exported ics file out of Google and then clone it.

    I ended up creating two separate ics file generators - one for iCal (easy!) and one for Google (hard). Maybe a third is needed for Outlook.

    Soon you should hit the next issue which is that Google require you specify the timezone for the ICS file and each event which makes coding your app much more complex. Apple iCal by comparison lets your app publish "floating times" which are assumed to be local.

    There's a bunch of ics file validation tools you might try like this one which can be really helpful...

    http://icalvalid.cloudapp.net/

    Caveat: Files that pass this validation tool still fail with Google. Google should really create it's own ics validation tool.