Import Thunderbird Contacts Into GMail
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.
May 1st, 2007 at 10:21 am
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.
May 1st, 2007 at 10:55 am
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.
May 11th, 2007 at 12:35 pm
How do I do that using a Windows XP computer?
May 12th, 2007 at 6:20 pm
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.
May 16th, 2007 at 6:43 am
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.
May 16th, 2007 at 3:45 pm
galen@east-desktop:~$ cat a.csv | cut -dā,ā -f1,2,5 >> toImport.csv
cut: the delimiter must be a single character
May 18th, 2007 at 5:22 am
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
May 18th, 2007 at 11:17 am
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/
December 12th, 2007 at 3:13 pm
ok, you put the correct columns and works, but… you can’t edit those contacs on gmail!!
April 14th, 2008 at 2:29 pm
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
April 14th, 2008 at 2:31 pm
ok, is your article meant for Linux or unix or Mac only?
There is a ‘cut’ command in unix.
April 14th, 2008 at 3:26 pm
Yes, there is a cut command in unix.
You can get one in windows too if you install http://www.cygwin.com/.
June 11th, 2008 at 12:52 pm
Thanks it worked !
August 13th, 2008 at 7:33 pm
Thanks Johan!