7/02/2011

Export the mobile contacts to excel sheet


Here's just another tech tip, in case you are of my type, someone who enjoys the freedom of using Gnu/Linux to get your personal work done. If you want to transfer the contact details from your phone to the computer, and probably upload to google docs - here is a simple way. I use Wammu to connect the mobile phone usually over bluetooth, and to create a backup of the contacts. I used a script which is available at this link:
http://blog.cone.be/2010/01/06/convert-a-wammu-backup-file-to-a-csv/.
So, here are my steps:
1. Create a backup of your phone contacts using Wammu, let's call the file Wammu.backup. This file is a binary file, but can be viewed in any standard text editor like vim/emacs.
2. Open the file using an editor which supports saving text in ASCII or unicode UTF-8. I use Gedit. Save the file as ascii or utf-8, as Wammu.txt.
3. Run the flip tool to get into text format which can show work with tools like grep. Make sure 'grep Name Wammu.txt' gives you  some result.
4. Rename the file into ConvertMe.txt.
mv Wammu.txt ConvertMe.txt
5. Run the tool convert.pl to generate the csv file of your contacts
./convert..pl >  mydata.csv
6. Customize the csv file as you need it. I use a dirty awk one liner.
cat mydata.csv | awk -F'"' {' print "\""$2"\"""," "\""$4"\"""," "\""$6"\"""," "\""$8"\""","  '} > mydata_updated.csv
This basically provides you a much simpler Name, number format.
7. Open the mydata_updated.csv file in open office spreadsheet, and if required convert to excel format.
8. If you like it, import to google docs.
Well that's it for now.

No comments: