5

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

  • You "have a handful of events" in what format or application currently? – Kevin Grabher Mar 24 '14 at 1:02
  • The "events" aren't in any particular format. I get an email with times and dates (sometimes multiple dates) and locations for different events, and it would be convenient to include the essential info in a .ics file (if I knew the format) and import that into Calendar. Thanks for your interest. – Bruce Mar 24 '14 at 21:53
  • Do you want to send an .ics file to other people? If so, you can just export an event or even calendar. If you would like to enter things people send you into your calender, the mac's "data detector" feature sometimes allows you to enter an event and aitomatically gets the data from the mail (if you hover your mouse over a date in an email, there should be a small triangle you can click). Or check out the app fantastical - maybe that is what you're looking for – Kevin Grabher Mar 24 '14 at 22:03
  • 1
    no, I don't want to send an .ics file. I want to write my own .ics file and import it into my Calendar. Thanks. – Bruce Mar 25 '14 at 1:28
  • 1
    I was going to create an .ics by hand. Sometimes I get a lot of events in an email, and I thought it would be easier to paste the events into .emacs, do some "quick" editing, and then import the .ics file. I may still try this, but (as you suggest) it might be simpler to simply create events in ical (or to use Fantastical, as someone else suggested). Thanks. – Bruce Mar 26 '14 at 20:36
10

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.

3

A few years ago I wrote a quick explanation of how to build an ics calendar generator using MySQL and PHP. You might find that useful.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .