Export Address Book to records to CSV format

Nov 08, '04 08:29:00AM

Contributed by: gboudrea

I wanted to be able to move all of the info for my Address Book contacts into my GMail account: phone numbers, addresses, etc. I tried AddressBookToCSV, which exports all Address Book entries to a CSV file which I can import in GMail, but it didn't capture everything.

So I wrote this AppleScript, which basically loops on all contacts in the Address Book and exports each of them (using a list of fields to export) into a text file. There are three lines to configure at the top of the script: where you want the result, which fields you want to export, and if you want duplicate entries for multiple email addresses -- i.e. a user with three email addresses will be exported to three different lines.

Note: You can remove fields from the default list, but you can't add any other field unless you also add a block of code to export it correctly below. Some fields are easy to export, like names or organization names, but others, like addresses or phone numbers, are trickier. Enjoy!

[robg adds: I tested this script and it worked, with one caveat: If I left the third config option (for multiple entries for multiple email addresses) set to true, then the script would unexpectedly quit before finishing. Once I changed it to false, it worked as described.]

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20041104212239178