Mac – How to export address book to mailchimp or CSV file

contactscsvmac

I want to export specific address book groups to mailchimp from a clients Mac computer.

The client have version OS X Lion (10.7) and the Mac she has is faulty and will be scrapped soon. Therefore it is not feasible to upgrade it.

It would be perfect if I could use Chimport but it appears that I need OS X Mountain Lion to use Apple Mac Store to get it.

Alternative do you know any programs that can export to CSV?

Best Answer

The following AppleScript will export all the names and e-mail addresses from Contacts.app. It was written for OS X 10.9 but should work on older editions; you may need to change Contacts to Address Book to talk to the appropriate application:

To use this AppleScript:

  1. Launch AppleScript Editor from Applications > Utilities
  2. Copy and paste the code below into a new document
  3. Run the script
  4. On completion a contacts.csv will appear on your desktop

Export Contacts to CSV AppleScript

-- Save comma separated values (CSV) file to desktop
set exportPath to (path to desktop as string) & "contacts.csv"

set contactsCSV to "" -- variable to collect rows of addresses
set quoteString to "\"" -- constant to ease concatenation

tell application "Contacts"

    -- Repeat with every person in your Contacts
    repeat with x from 1 to the count of people
        set thePerson to person x
        set theirName to the name of thePerson

        -- A person may have multiple e-mails addresses, add one row for each
        repeat with anEmail in the email of thePerson
            set contactsCSV to contactsCSV & quoteString & theirName & quoteString & "," & quoteString & (value of anEmail) & quoteString & "
"
        end repeat
    end repeat

end tell

-- Write the CSV contents to a file
set exportFile to open for access file exportPath with write permission
set eof of exportFile to 0
write contactsCSV to exportFile starting at eof
close access exportFile