Thursday, January 28, 2010

How to import Nokia (or any .csv) contacts into Thunderbird 3 on Windows XP

There may be a more elegant way to do this; I'm simply documenting the method that I ultimately found successful, in the hope that someone, somewhere may be saved some time.

I was working with a Nokia 3110c. I have no idea whether that matters, but I would expect that the same method would work for any Nokia that you could connect to the Nokia PC suite.

Software required (you may be able to use other versions of the software, but I don't know):
1) Nokia PC Suite  ver.
2) OpenOffice Calc 3.1.1 (You could equally well use Excel or any program that allows you to look at CSV (comma separated values) files.
3) Thunderbird 3.0.1

Optional: AutoHotKey v. 1.0.48

Part 1: Exporting contacts from Nokia 3110c
  1. Open up Nokia PC Suite and go to the Contacts manager. Follow the on screen instructions to connect your phone with the application. It's fairly straightforward to do so.
  2. Select all the contacts you want to export (Note: I save my contacts to phone. If you have them saved to SIM, you may need to copy them to your phone first.). If you want to export all of them, Ctrl-A works as Select All. If you want to export some of them, use Ctrl-click to select all of the ones you want.
  3. Go to the File menu, and select Export.
  4. Pick a convenient location to save the file. You will need to open it again fairly soon.
  5. Give your file a name (nokiacontacts or some such), making sure that the Save as type: box has Comma Separated Values (*.csv) selected.
  6. Press the green check mark.
  7. Exit Nokia PC Suite
Part 2: Formatting contacts file for import into Thunderbird
  1. Open up Thunderbird.
  2. Click on the Address Book button or simply Ctrl-Shift-B
  3. Go to the Tools menu in the Address Book window and select Export.
  4. Choose a location and filename.
  5. Make sure, once again, that the Save as type: box says Comma Separated. The default on mine is LDIF.
  6. Click on OK.
  7. Boot up Calc/Excel/whatever program you will use to edit your CSV file. (The instructions that follow are specific to Calc. Some of the steps may be different if you are using other software.)
  8. Open the .csv file you created in Part 1 from your Nokia phone contacts.
  9. The Text Import dialog box should open up. The first option you can change is Character Set. Change this from Unicode to Western Europe (Windows-1252/WinLatin 1). I'm not 100% certain you have to do this step, but I think it might be critical.
  10. Check that the Separated by: option has the Comma box checked off.
  11. Press OK.
  12. You should get a spreadsheet with the first column "Title" preceded by some gobbledygook characters. Delete the gobbledygook. Save the file, selecting Keep Current Format.
  13. Also open up the .csv file you exported from Thunderbird. You'll notice that the Character set reads Western Europe (Windows-1252/WinLatin 1). Leave it that way. 
  14. If you compare the two files, you'll notice that the fields are not exactly the same. So go ahead and plan which field from the phone contacts should map to a given field in the Thunderbird addressbook. Depending on how detailed the info is that you keep in your phone, this may take some time. I advise that you actually change the names of the columns in the nokiacontacts.csv to match the Thunderbird fields.
  15. Delete all the columns in nokiacontacts.csv that you won't be mapping to Thunderbird. If you don't have an equivalent field in Thunderbird, you can transfer it to a Custom field. There are 4 available.
  16. THIS STEP IS REALLY IMPORTANT: You may or may not notice that Thunderbird has a First Name field, a Last Name field, and a Display Name field. You HAVE to put something in the Display Name column if you want names to show up when you look at your contacts in Thunderbird. Otherwise, the names will be there, but will not show up unless you open the contact up for editing. You have some options for what to do about the Display Name field. The next few steps are what I chose to do.
  17. Make a copy of the First Name (DupFirstName) and Last Name (DupLastName) columns in the nokiacontacts.csv file.
  18. Select a contact's DupFirst and DupLast names. So if First Name is Mohammed and Last Name is Ahmed, select Mohammed and Ahmed from the DupFirstName and DupLastName columns. Now merge those two cells (Alt-O-E). Calc will ask if the contents should be moved into the first cell. Tell it Yes.
  19. Either go through and do this for each contact or follow OPTIONAL PART 2a.
  20. Save nokiacontacts.csv, making sure to Keep the Current Format.
OPTIONAL PART 2a. Automating the Display Name Merge I have 521 phone contacts. I was not looking forward to repeating Step17 521 times. So I wrote a little AutoHotKey script to do the merging for me. Here's the script. You will need AutoHotKey to make it work.
    1. Open up Notepad or any text editor.
    2. Enter the following script, which simply automates Step 18, telling the software to select the cell to the right, press Alt-O-E, then Alt-Y, then Enter. And repeat this 520 times.
loop, 520
;YOU SHOULD REPLACE the 520 in the above line with the number of contacts you need merged.
{Send +{Right}!oe
SetKeyDelay, 15
Send !y{Enter}
3. Save the text file as merge.ahk
4. Install AutoHotKey. I got it a long time ago and don't have the URL handy, sorry. Might add it later.
5. Double click on the icon for merge.ahk
6. Return to nokiacontacts.csv. Select the first DupFirstName entry. Hit Windows-M and let AutoHotKey complete the merge for you.
IMPORTANT NOTE: This script assumes that you have DupFirstName and DupLastName in adjacent columns. Also, it may be a kludgy script. I've never used AutoHotKey before, and I have no programming experience.
7. Go back to the Part2 instructions.
Part 3: Importing contacts file into Thunderbird
  1. Open up Thunderbird
  2. Press Alt-T-M or go to the Tools menu and select Import.
  3. At the Import dialog box, select Address Books and click on Next.
  4. In Select the Type of File, choose Text File (LDIF, .csv, etc.)
  5. Select your nokiacontacts.csv file. The dialog box will read LDIF at the bottom. You will need to change that to All files or Comma Separated in order to see your .csv file.
  6. You should now see an Import Address Book dialog box. The column on the left shows the Thunderbird Address Book fields, and the column on the right shows the nokiacontacts.csv fields.
  7. You have to move the Thunderbird fields up and down to match the appropriate nokiacontacts.csv fields. TIP: Start by matching up with the first field from nokiacontacts.csv, and work your way down, otheriwise you will have to keep realigning fields. So align First Name with First Name, then Last Name with Last Name, etc. Thunderbird remembers the order you last used, so if you've never imported an addressbook before, and you put your nokiacontacts.csv columns in the same order as the thunderbird.csv file, you may not have much realigning to do. I've messed around with it too much to know for sure.
  8. Make sure you have all the appropriate Address Book fields checked. Every time you click on the field, you toggle the checkbox.
  9. Press OK.
  10. Enjoy the fact that you have now done in 15 minutes what it took me a few hours to figure out.
At some later point, I will try to figure out whether I can actually merge address books. Will update the post then.

No comments: