| Subcribe via RSS

Import Thunderbird Contacts Into GMail

May 1st, 2007 Posted in Browser, HOWTO

It’s easy to use the “cut” command to convert your Thunderbird contacts into a format that GMail is happy to import.

Start out in Thunderbird, click Tools, Address Book. Once the Address Book pops up click Tools, Export. A save dialog should popup asking you to for a filename and folder. Look down by the save button, change the format dropdown from LDIF to CSV, name the file myExport.csv and click Save. The default of the home dir should be fine.

All of your T-Bird contacts are now in the CSV file, but GMail won’t appreciate the extra columns and lack of headers. We can fix that easily from the command line. Open a shell and change to the directory where you saved your CSV. Run the following command:

echo First Name,Last Name,Email Address > toImport.csv ; cat myExport.csv |cut -d”,” -f1,2,5 >>toImport.csv

Now head over to your gmail account and import the csv. The Import link is on the “Contacts” page near the top right.

GMail should report success once it’s done processing the file and tell you how many contacts it imported.

No Responses to “Import Thunderbird Contacts Into GMail”

  1. Dr Jan Says:

    I’m using Thunderbird 2.0.0.0 (20070326) and the header record was already in the file.

    So, my command line was:

    cat myExport.csv | cut -d”,” -f1,2,5 >> toImport.csv

    Looking at your example, I think your filenames are confused. I think you’d need something like this:

    echo First Name,Last Name,Email Address > toImport.csv ; cat myExport.csv |cut -dā€,ā€ -f1,2,5 >>toImport.csv

    Cheers,
    Jan.


  2. Anton Says:

    Thanks, I fixed the error above.

    I’m running tbird 1.5.0.10 that comes with Ubuntu Feisty and checked again and it didn’t export the header. I’ll try version 2 later and see. I suspect they added it recently and hope they didn’t take it away.


  3. Charbax Says:

    How do I do that using a Windows XP computer?


  4. Anton Says:

    Charbax,

    I really don’t know how to do that in XP. Look for Cygwin as a way to install some reasonable shell utilities on XP. Back in the 90s I used to run Cygwin on NT 4 to get the more useful command line tools.


  5. MQ Says:

    To do this in Windows XP you can do one of two things:

    1. Download Cygwin and put C:\Cygwin\bin in your path (then you’ll get all the unix utilities on the windows command line (this is really useful for other things as well).

    2. Open the CSV in a spreadsheet editor (OpenOffice Calc, Google spreadsheets, MS Excel) and delete all rows EXCEPT rows A, B, E (this is what cut -d”,” -f1,2,5 does) then resave the file as a CSV file.


  6. galen Says:

    galen@east-desktop:~$ cat a.csv | cut -dā€,ā€ -f1,2,5 >> toImport.csv
    cut: the delimiter must be a single character


  7. Johan Says:

    After you have exported the addresses into a csv file:

    - Open up the csv file with Excel (or similar)
    - Make sure there are only three columns
    - and give them these headings
    First name, Last Name, email adress
    - Save as csv

    No need for strange command lines …

    //jo


  8. Anton Says:

    Wordpress screws with the quotes, replace them with the correct ones.

    I just installed the Unfancy quote plugin so you can copy paste and it will work now.
    http://www.semiologic.com/software/unfancy-quote/


  9. carlos Says:

    ok, you put the correct columns and works, but… you can’t edit those contacs on gmail!!


  10. Jim Rogers Gui Says:

    Thank you for sharing this useful tip, but may I know where can I get this ‘cut’ tool? It isn’t find in stock Windows 2000 or XP or Vista. Looking forward to hearing from you. Regards J R Gui


  11. Jim Rogers Gui Says:

    ok, is your article meant for Linux or unix or Mac only?
    There is a ‘cut’ command in unix.


  12. Anton Says:

    Yes, there is a cut command in unix.

    You can get one in windows too if you install http://www.cygwin.com/.


  13. Tom Says:

    Thanks it worked !


  14. Pete Says:

    Thanks Johan!


Leave a Reply