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.
19 Comments
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.
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.
How do I do that using a Windows XP computer?
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.
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.
galen@east-desktop:~$ cat a.csv | cut -d”,” -f1,2,5 >> toImport.csv
cut: the delimiter must be a single character
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
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/
ok, you put the correct columns and works, but… you can’t edit those contacs on gmail!!
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
ok, is your article meant for Linux or unix or Mac only?
There is a ‘cut’ command in unix.
Yes, there is a cut command in unix.
You can get one in windows too if you install http://www.cygwin.com/.
Thanks it worked !
Thanks Johan!
Hey Guys none of this is any help to me as I dunno what a Shell or Cygwin or any of the stuff you talk about is?? I have manually Transferred all my Contacts From T/ Bird into an Excel File on the desktop called “MyExportCONTACTS Gmail” saved as csv excel file I have Manually made Header’s as Name and Email adress in A1 & B1 columns – then listed all of them down to 50 AB whta next? Dasha
If you manually entered the contacts into excel, why didn’t you just manually enter them into gmail? It would take about the same amount of time.
To import into gmail, all you need is a clean CSV with 3 columns: First Name, Last Name, Email. Create that however you want, then import it into gmail.
You could open the original tbird contacts file in excel, deleted the columns that gmail doesn’t need, save as CSV, and import it into gmail.
I have done this with Cygwin and Thunderbird on Windows Vista and the command above and import to gmail worked perfectly!
But as mentioned above it would be possible to just delete all the columns except “First Name”, “Last Name”, “Primary Email” in the original csv using excel or open source equivalent. Just need to rename column “Primary Email” to “Email”, and make sure you save it again as a .csv.
All you have to do is delete every column but First Name, Last Name and Primary Email. Rename Primary Email to just say Email. Now when you import the .csv file into Gmail it works beautifully. I didn’t do any specially programming or Cygwin/Shell stuff
Cheers!
PS: Of course, one caveat to my recommendation above is that you lose any other info you might have in your contact database like physical addresses, etc.
This solution looks promising however: http://www.matthewjmiller.net/howtos/importing-gmail-contacts-from-thunderbird/
2 Trackbacks/Pingbacks
[...] default .CSV file, GMail doesn’t properly parse the contact info. Luckily, I found this blog post with a solution. It only works for Linux users, but that’s fine with [...]
[...] to gmail Anton Olsen.com
Post a Comment