Calendar (iCal) .ics format

calendarical

I have a handful of events that I want to enter into Calendar. Since I have a lot of events, I'd like to copy/paste into a file and import the file, rather than enter them manually. Does anyone know the format for a given event?

I found this in an .ics file:

BEGIN:VEVENT
SUMMARY:Girls U14 Div 1A- Newton G Panthers VS Arlington GU14 A Team 
UID:5248
DESCRIPTION;ENCODING=QUOTED-PRINTABLE: There is a game at Valeo Main - Valeo Main
LOCATION:Valeo Main - Valeo Main
DTSTART;TZID=/US/Eastern:20131109T100000
DTEND;TZID=/US/Eastern:20131109T113000
URL:http://www.bays.org/iCal/iCal.php?2339
END:VEVENT

Looks fairly straightforward, although I don't know what to use for a UID.

Thanks, Bruce

Best Answer

The iCalendar specification outlines what is required in an .ics file. In short, a simple .ics file looks like this:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:19970610T172345Z-AF23B2@example.com
DTSTAMP:19970610T172345Z
DTSTART:19970714T170000Z
DTEND:19970715T040000Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR

The UID is a unique identifier. It's mostly used for sequencing multiple iCalendar requests. The iCalendar specification gives guidance for how to create it:

A good method to assure uniqueness is to put the domain name or a domain literal IP address of the host on which the identifier was created on the right-hand side of an "@", and on the left-hand side, put a combination of the current calendar date and time of day (i.e., formatted in as a DATE-TIME value) along with some other currently unique (perhaps sequential) identifier available on the system (for example, a process id number). Using a DATE-TIME value on the left-hand side and a domain name or domain literal on the right-hand side makes it possible to guarantee uniqueness since no two hosts should be using the same domain name or IP address at the same time. Though other algorithms will work, it is RECOMMENDED that the right-hand side contain some domain identifier (either of the host itself or otherwise) such that the generator of the message identifier can guarantee the uniqueness of the left-hand side within the scope of that domain.

Most calendar applications are pretty forgiving of malformed .ics files. If your events are pretty simple (no recurrence, no invitations, etc), it's probably not too difficult to knock together an AppleScript (or whatever scripting language you prefer) to create these for you. Here's one AppleScript for it from StackOverflow.