cpbotha.net

voices in my head

cpbotha.net random header image

Google Calendar to Palm Desktop conversion

April 26th, 2007 · 193 Comments · tech

(The short story is: if you want to convert Google Calendar iCal v2 files to vCal v1 files for import into your Palm Desktop, use this web application I made last night. Please leave a comment on this posting if you use it!

If you’re interested in recent changes to the application, see the dynamic changelog on Google Code.)

It’s amazing how just when you really do need to put all your time into some deadline, you find the perfect WAB, better known as Work Avoidance Behaviour.

In any case, last night I was planning to work on two proposals with rapidly approaching deadlines, instead I somehow was convinced that it should be easy to import some of those neat iCal v2 files available on the web (for example as exported from Google Calendar) into my trusty Palm Desktop 4.1, which I use on my laptop to manage my life and synchronise with my Palm Tungsten C.

It turns out that this is far more complicated than necessary. Google Calendar only outputs iCal version 2, Palm Desktop, even the latest version, only imports vCalendar version 1. There are a number of websites that state that simply renaming the .ics file to .vcs, and changing the version tag to 1.0 does the trick. WRONG. Google Calendar iCal files actually use iCal version 2.0 features, so this idiot workaround does not, well, work around.

By now it was almost time for bed, and I’d tried Sunbird (exports ical v2), Evolution (the windows version is the worst POS software I’ve ever come across) and bunches of other things. No go. Finally I stumbled on vcal.py by Mark Bucciarelli. This almost worked, except for a few bugs (empty field handling, a.o.) which I fixed, and the fact that it doesn’t handle RRULEs at all. After reading the vcal standard, I implemented a really ugly RRULE transformation that seems to do the trick, mostly.

I’ve packaged all of this ugliness in a simple CGI that you can now use to convert Google Calendar iCal version 2.0 files to vCal version 1.0 files for consumption by your Palm Desktop. Use this entirely at your own risk of course, but let me know in a comment on this post (see below) if it works, or if it doesn’t.

Click here to convert!

(if you’re interested in the patch source, go to the ical2vcal site on googlecode.)

Related posts:

  1. Copernic Desktop Search 1.6
  2. Backport of unison 2.27.57 to Ubuntu 7.10
  3. Palm News
  4. Tungsten-E approaching at high speed
  5. First thoughts on the Tungsten E

Tags:

193 Comments so far ↓

  • JB

    an error occurred while importing the vcal file. The file may not be a valid Vcal file. After converting and getting text file I saved as .vcs but notes type file as text file so not sure if I am doing this right?

  • cpbotha

    @JB: Are you getting the error message when converting your ical file to vcal with the script, or when you try to import the resulting vcal file into your Palm Desktop?

  • JB

    when trying to import the file into palm desktop

  • Lisa

    When I convert the file and then use File>>Save Page As…..I don’t seen an option to save as vcs. Just Text Document or All Files .

    Do I use Text Document but name the file #####.vcs??

    Can someone help me please?

    …Lisa

  • cpbotha

    @Lisa: Yes, you have to select “Text Document” and name the file as something.vcs. HTH, Charl.

  • Radhika

    Hi ,,

    Could you suggest as to, how can I save a text file in timestable – in Java Programming ??

  • Jake

    Nice work on the conversion program….However, I also had to cut and paste into Notepad to get it to work.

    I am a pilot and some of my flying can be over 1 to 4 days. The single dayers are inputed fine into palm (ie 8am to 5 pm flt)…but if I have a pairing that goes for 2 days or more…..it only inputs the name of the pairing without any blocking time info in palm.

    Any suggestions?

    Thanks a miliion

  • cpbotha

    @Jake:

    This is a limitation of the Palm Desktop as far as I can see. See this Palm Knowledge Base article under the topic “Cannot handle multi-day events. Converted to Untimed event.”

    So there’s not much the ical2vcal converter can do about this.

    What you could try is to turn multi-day events into single-day events that repeat for that number of days. That should work, but is perhaps too much effort for what you gain.

  • dankrebs

    hmmm…I get the same error that many others have reported: “An error occurred while importing the vCal file. The file may not be a valid vCal file.”

    I’ve tried it with firefox and explorer, saving as a text file then renaming it to .vcs, saving as a .vcs outright and copying and pasting into notepad.

    Actually, copying and pasting into notepad allowed for it to be imported, but there’s lots of gobbledygook, especially lots of “/n/n/n/n/n” everywhere…

  • cpbotha

    @dankrebs: I still have to diagnose that error given the sample files that helpful users have submitted. Are you seeing “/n/n/n” or “\n\n\n” ?

  • dankrebs

    thanks for the reply.

    Sorry, you’re right, it’s “\n”, and not “/n”.

    In the meantime, do you know of any other way for me to easily convert this file?

    Thanks!

  • Lisa Prolman

    I’m getting the error message “An error occurred while importing the vCal file. The file may not be a valid vCal file.” as well. I’m using explorer but haven’t tried Firefox yet. Is there something I’m not doing correctly? Or should I check back at a later time to see if there’s been a fix? THANK you so much for this!

  • cpbotha

    @Lisa: I’m working on fixing some of the previous errors I got. As soon as I’ve updated the software, I’ll put an update message in the posting, and also as a comment. Try again (should be in a few days, I hope) and let me know!

  • Lisa Prolman

    BTW, I’d be happy to send you the file, but I’m not sure how…

  • cpbotha

    @Lisa: send it to me at cpbotha at-sign-thingy cpbotha dot net, thanks.

  • fsvw

    Hi – neat tool!

    I am glad a colleague sent me a link to your website. He has written a nice tool to convert my work schedule (in pdf) to ics. And as you know that won’t work with Palm.

    Anyway, I have a question too. Is it possible to import categories into Palm using vcalendar? I end up having to manually change the categories for each event in Palm Desktop. It’s a bit tedious…

    Greetings

    Fillip

  • Todd

    lovely program. between toodledo’s exported task list and your wondrous calendar transformer, I have a brute force way to keep all my admin sort of in sync. just went through and cleaned up dupes from the past year (generally no more than 3-4 per event) – now I will see how long it takes them to build back up again. perhaps I will try the datebook file delete option recommended in the comments above. much more effective than the pricey pay version avail through the SW site…

  • Al

    Thanks, this is a big help.

    Works well-enough with MSLookOut’s .ics files
    & Palm Desktop 4.1.4 picks up the .vcs

    For folks who want to run the python script locally
    (after you get Python), add these line to the .py file:

    Disclaimer: This is *day-one-level* python hacking,
    and I’m not a coder. But I had some fun/success.

    icalfilein = raw_input(“What’s the ical filename? “)
    import vcal
    calendar = vcal.parse(icalfilein)
    f=open(‘yyy.vcs’, ‘w’)
    f.write(calendar.as_vcal())
    f.close()

    You might not want to pump some “corporate” meeting details
    across the net..

    Peace

  • JP

    It worked first time – thank you.

    Is there any way of selecting in which Category it will appear in Palm desktop, rather than Unfiled?

  • Paul Williamson

    Used it again for my annual conversion from ics to a vcal calendar needs – worked 100%. Thanks.

  • JCaffrey

    Just tried this and received the same error message mentioned by others when trying the import “An error occurred while importing the vCal file. The file may not be a valid vCal file.”
    Any suggestions – has something changed with the code yet?
    I am using Palm Desktop version 4.2
    thanks.

  • MS

    thank youuuuu!

  • Ben

    I got this to work using python and this sequence:

    >>> import vcal
    >>> calendar = vcal.parse(“unfiled.ics”)
    >>> f=open(‘unfiled.vcs’,’w’)
    >>> f.write (calendar.as_vcal())
    >>> f.close()

    But when I try to import into Palm Desktop, all the events show up without a time, until I edit the .vcs file manually to put the DTSTART tag before the DTEND tag.

    Any idea why the tags should show up in the wrong order? (The .ics file comes from an Apple iCal export)

  • M. Graves

    Thanks, it’s a very useful script. I am using it to convert exported ics files from Sunbird for import into Palm Desktop 4.1.4. I made a small change to the cgi script to allow the browser to download the generated vcs file instead of displaying it in the browser as plain text, using the same basename as the ics file being uploaded. (No more need to copy/paste the results to a file.) So for example, if you upload a file named ‘mycalendar.ics’, your browser should prompt you to save the generated vcs file named ‘mycalendar.vcs’. I used Firefox 2.0.0.12 to test it.

    diff ical2vcal.cgi ical2vcal.cgi.orig
    60,70d59
    < icsfilename = fileitem.filename
    < if icsfilename.endswith(“.ics”):
    < vcsfilename = icsfilename[0:len(icsfilename)-4] + “.vcs”
    < else:
    < “”"the name of the file being posted does not end with .ics
    < so just add .vcs as the file extension. or we could
    < warn the user that this may not be a valid ics file
    < and return False…
    < “”"
    < vcsfilename = icsfilename + “.vcs”
    <
    84,85c73
    < print “Content-Type: text/x-vCalendar”
    print “content-type: text/plain\n”

    Thanks again.

  • cpbotha

    Dear M. Graves,

    Great, thanks for the patch! Could you perhaps mail it to me as a unified diff, with the direction correct? I.e. do “diff -u ical2vcal.cgi.orig ical2vcal.cgi”

    I’ll integrate it (and put your credit on the CGI page of course!)

    Thanks,
    Charl

  • M. Graves

    No problem, the email is on the way. I’ve used the content-disposition header before, but I found the mime type to use here:

    http://www.phpbuilder.com/columns/chow20021007.php3?page=4

    The article also has some useful links for iCal and vCal in the resources section at the end.

  • Jonah Hershowitz

    Thank you very much for this application. Unfortunately, as for some others, for me it did not work–Palm Desktop thinks the resultant file isn’t vcal.

    I’ve sent both files, and hopefully it will be of help.

    Best,

    Jonah

  • John Humphrey

    With Palm Desktop 6.2.2 and a .ics v2 file this converter worked super! I am defiantly bookmarking this site. :->

  • Abe

    Thank youuu

    I have been looking for days on how to do this. Finally.

    1) Export from outlook csv file
    2) Import into Google Calander
    3) Export from google calender into an ics file
    4) use this utility to convert to vcs file
    5) THEN cut an paste into text file change the extension to vcs and save ( I tried saving the output as is in changing it to vcs and it did not work)
    6) import to Palm

  • bj

    Will your convertor work on a 4.5mb file. I got an internal server error. said to contact you. thanks.

  • Mars

    Thanks! Works perfectly for my needs.

  • Mars

    OK, one more thing to make it absolutely perfect for my needs: A wrapper that reads the contents of an ics file from standard input and writes to standard output, so you can do something like this:

    ics2vcs meeting.vcs

    Python programmers can figure this out themselves and do a better job of it than I can, but for anyone else who like this sort of behavior, here’s my “day one python” (as Al said above) code:

    import vcal
    import sys
    sys.stdout.write(vcal.parse(sys.stdin.read()).as_vcal())

    Or if you don’t like the terse “functional programming” style code in the last line, the following does exactly the same thing and is (I admit) more readable (but for perverse taste like mine less elegant):

    import vcal
    import sys
    calendar = vcal.parse(sys.stdin.read())
    sys.stdout.write(calendar.as_vcal())

    In a Unixey system, you can stick “#!/usr/bin/python” or something like that at the beginning of the file and make sure that vcal.py is in the same directory or a directory listed in PYTHONPATHS. In Windows, if you want to run it in a CMD window, you could probably put “python ics2vcs” or something like that in a batch file.

    Thanks CPBotha!

    -Mars

  • Mars

    Sorry, that line where I demonstrate running the script came out wrong. It’s not:
    ics2vcs meeting.vcs
    but rather:
    ics2vcs lessthansymbol meeting.ics greaterthansymbol meeting.vcs
    Another try:
    ics2vcs < meeting.ics > meeting.vcs

  • PhotoJoe

    Does not work with Palm Desktop 6 and the current googlecalander.

    Am I doing something wrong?

  • PhotoJoe

    “Nice work on the conversion program….However, I also had to cut and paste into Notepad to get it to work.”

    I read that, did that, and it worked.

    Odd that simply saving the page as a *.vcs didn’t work.

  • cpbotha

    M. Graves sent a patch that i still need to integrate (hopefully I’ll have time sometime this century) that will allow you to download the generated file as vcs file.

  • skywind

    I just used this to convert and it worked nicely. I did notice one bug – on google calendar, I create events that span multiple days (all-day event like a vacation). In Palm Desktop, I’m hoping to see that become a day event, marked as an all-day (no time), with a repeat of X number of days till then end.

    Instead, I get an import error from palm desktop, that it can’t import an event that spans multiple days, and it puts it in as the first day only.

    For my case, that was fairly easily to correct by hand, though I did have 8-10 entries that happened for. However it would be nice if the event data would be converted automatically to a repeat-day type palm calendar event, so it came in right. If my description is awkward, I can create some sample data files for you that show the issue.

  • Geri

    Thank you very much! I am considering replacing the palm – but until then, this is so helpful.

  • c hagley

    Can you help a real neophyte? I just switched to Mac and HATE how palm calendar looks and functions on a mac. I like the look and operation of ical, but have no experience with any other calendar programs. What is my best option, short of entering everything twice (on Treo and into ICAL)?

  • cpbotha

    Hi there C Hagley,

    I’m sorry, but I can’t help you on a Mac. Surely there must be a solution to sync between ICAL and the Treo?

  • Jason

    Hi, I’m trying to see if you code can work for me. I am trying to import my calendar from Essential PIM to my phone’s software to sync my calendars. I can export my cal from EPIM in ical but can only import vcal in Samsung’s software. I tried your code but when I import the resulting file I get an error “Invalid Recurrence YM1 23011231.”

    Do you have any idea what might be happening? Only the first appointment shows up in Samsung’s calendar.

    Thanks

  • Lisa

    Great app!

    If I convert my Google Calendar to vcal and import it into my Palm Desktop, does that overwrite the calendar and events on my Palm or does it just add my Google Calendar events to my Palm?

  • cpbotha

    @Lisa:

    Thanks!

    As far as I know, Palm Desktop should just add the events to your existing events. I’m not sure what’ll happen if ALL event details are identical though (same description, date, time, etc etc).

  • Lisa

    I got this error when converting…can someone help me please? Does it matter that the Google calendar I am exporting for conversion is not my primary Google calendar?

  • Lisa

    Sorry, I forgot to put the error in my comment. It is:

    “Error parsing your upload: vCal Parse Error: No BEGIN:VCALENDAR–invalid vcal file (at character 0)”

    …Lisa

  • Reuben Janzen-Martin

    Thanks for the short-cut. It seems to work well, although a few of the end dates for “repeated” events didn’t work properly. They just kept repeating forever instead of stopping on the required date. I only had a few of these, so I fixed them manually.

  • Dennis Jennings

    Thank you – just what I needed.
    Pardon my ignorance, but have you turned this into an App that I can run when I get an ical that works as some sort of Palm extension and just imports the calendar item directly into Palm desktop ?
    Many thanks
    Dennis

  • cpbotha

    @Dennis Jennings:

    No I have not made such an app. :)

  • Paul Williamson

    Hi

    “Click here to convert!” link doesn’t seem to open a web page??

    Help.

    Thanks
    -Paul W

  • cpbotha

    @Paul Williamson:

    Seems the machine hosting the script has died during the night (GMT+2 time). It will be rebooted shortly…

    (August 1, 9:50 GMT+2)

Leave a Comment