Google Contacts and Mozilla Thunderbird

2009
Jan
2
4

Tags

I recently changed my email client to Mozilla Thunderbird and I wanted to move over all of my Google contacts to my local address book. Unfortunately though there didn't see to be a clear way to do this. Google will allow you to export them as vcards but you can't import vcards into Thunderbird. I did find a nifty extension for Thunderbird that will import version 2.1 vcards (link) but Google exports them as Version 3.

Since I run ubuntu as my main operating system I installed the multisync-tools package which has a utility for converting vcards from v3 to v2.1 and vise versa. I used it to convert the vcards to the 2.1 format. But I found out that Thundersync does not really like having all the vcards in one file so I found a Perl script that cuts up the cards into separate files(link). This worked and I did get the contacts imported but a lot of the info was in the wrong fields probably from all of the converting and such.

So I thought this would be a good time to brush up on my ruby since I had been working with Drupal so much lately. Also it was a good exercise in learning the Google Data API. I just created a script that would retrieve an XML file from Google, parse the xml and create a file that thunderbird would accept. I have included it on this post in a tar ball just in case it would be of use to anyone else running into the same issue I had.

to use it just extract it into a directory and from the comandline run:

Then you should have an ldif file you can import easily into thunderbird.

Edit: I noticed that newer versions of Thunderbird allow you to import vcards.