Saturday, October 16, 2004

Outlook to Gmail

I recently got a GMail account.

I noticed they provide a way to import contact from CSV files. So I decided to import my contacts from Outlook. I found that if you open outlook Contacts and select all contacts, you can "save As..." to make a text file. The format is as follows :

...
Full Name: Nigel Thorne
Last Name: Thorne
First Name: Nigel

E-mail: blogFeedback@nigelthorne.com
E-mail Display As: Blog Feedback
...

This isn't CSV, so I had to change it. A couple of second with notepad and Gawk had the following on the screen...

Name, Email Address
Nigel Thorne, blogFeedback@nigelthorne.com
...

Here is the gawk script I used. I handled first and last name seperately because I had some names in my contacts that didn't export correctly

BEGIN{ print "name , Email Address" }

/Full Name/ { lastName = ""; firstName = ""; email = ""}
/Last Name/ { lastName = $3}
/First Name/ { firstName = $3 }
/E-mail:/ {email= $2}
/Display/ {print firstName, lastName "," email}

If you are lucky thought the following should work just as well.


BEGIN{ print "name , Email Address" }
/Full Name/ { name = $3 $4 $5 $6}
/E-mail:/ {email= $2; print name "," email}
Post a Comment

GitHub Projects