Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm running Evolution 3.0.2 (stack from a Fedora 15 install). I have a CSV file with a few contacts. This file was created by a Samsung software, when backing up an old telephone I had.

If I go to File -> Import... -> Import a single file and select my file I'm giving three options for File Type:

  1. Evolution CSV or Tab (.csv, .tab)
  2. Mozilla CSV or Tab (.csv, .tab)
  3. Outlook CSV or Tab (.csv, .tab)

I've tried importing using all of the three options but not a single of them seems to work: the destination location is unmodified.

The Samsung-generated file is quite verbose. This is it's first line:

"Last name","First name","Display name","Nickname","Reading name (Last name)","Reading name (First name)","Official title","Company name","Phone number1 (Type)","Phone number1 (Number)","Phone number1 (Hot key)","Phone number2 (Type)","Phone number2 (Number)","Phone number2 (Hot key)","Phone number3 (Type)","Phone number3 (Number)","Phone number3 (Hot key)","Phone number4 (Type)","Phone number4 (Number)","Phone number4 (Hot key)","Phone number5 (Type)","Phone number5 (Number)","Phone number5 (Hot key)","Phone number6 (Type)","Phone number6 (Number)","Phone number6 (Hot key)","Phone number7 (Type)","Phone number7 (Number)","Phone number7 (Hot key)","Phone number8 (Type)","Phone number8 (Number)","Phone number8 (Hot key)","Phone number9 (Type)","Phone number9 (Number)","Phone number9 (Hot key)","Phone number10 (Type)","Phone number10 (Number)","Phone number10 (Hot key)","Phone number11 (Type)","Phone number11 (Number)","Phone number11 (Hot key)","Phone number12 (Type)","Phone number12 (Number)","Phone number12 (Hot key)","Phone number13 (Type)","Phone number13 (Number)","Phone number13 (Hot key)","Phone number14 (Type)","Phone number14 (Number)","Phone number14 (Hot key)","Email1 (Type)","Email1 (Address)","Email2 (Type)","Email2 (Address)","Email3 (Type)","Email3 (Address)","Email4 (Type)","Email4 (Address)","Email5 (Type)","Email5 (Address)","Email6 (Type)","Email6 (Address)","Email7 (Type)","Email7 (Address)","Email8 (Type)","Email8 (Address)","Email9 (Type)","Email9 (Address)","Email10 (Type)","Email10 (Address)","Web page1 (Type)","Web page1 (Address)","Web page2 (Type)","Web page2 (Address)","Web page3 (Type)","Web page3 (Address)","Web page4 (Type)","Web page4 (Address)","Web page5 (Type)","Web page5 (Address)","Web page6 (Type)","Web page6 (Address)","Web page7 (Type)","Web page7 (Address)","Web page8 (Type)","Web page8 (Address)","Web page9 (Type)","Web page9 (Address)","Web page10 (Type)","Web page10 (Address)","Messenger1 (Type)","Messenger1 (ID)","Messenger2 (Type)","Messenger2 (ID)","Messenger3 (Type)","Messenger3 (ID)","Messenger4 (Type)","Messenger4 (ID)","Messenger5 (Type)","Messenger5 (ID)","Messenger6 (Type)","Messenger6 (ID)","Messenger7 (Type)","Messenger7 (ID)","Messenger8 (Type)","Messenger8 (ID)","Messenger9 (Type)","Messenger9 (ID)","Messenger10 (Type)","Messenger10 (ID)","Address1 (Home/Office)","Address1 (Domestic/Foreign)","Address1 (P.O. box)","Address1 (Details)","Address1 (Street number)","Address1 (City/Town)","Address1 (County/Region)","Address1 (Country)","Address1 (Postcode)","Address2 (Home/Office)","Address2 (Domestic/Foreign)","Address2 (P.O. box)","Address2 (Details)","Address2 (Street number)","Address2 (City/Town)","Address2 (County/Region)","Address2 (Country)","Address2 (Postcode)","Address3 (Home/Office)","Address3 (Domestic/Foreign)","Address3 (P.O. box)","Address3 (Details)","Address3 (Street number)","Address3 (City/Town)","Address3 (County/Region)","Address3 (Country)","Address3 (Postcode)","Address4 (Home/Office)","Address4 (Domestic/Foreign)","Address4 (P.O. box)","Address4 (Details)","Address4 (Street number)","Address4 (City/Town)","Address4 (County/Region)","Address4 (Country)","Address4 (Postcode)","Address5 (Home/Office)","Address5 (Domestic/Foreign)","Address5 (P.O. box)","Address5 (Details)","Address5 (Street number)","Address5 (City/Town)","Address5 (County/Region)","Address5 (Country)","Address5 (Postcode)","Address6 (Home/Office)","Address6 (Domestic/Foreign)","Address6 (P.O. box)","Address6 (Details)","Address6 (Street number)","Address6 (City/Town)","Address6 (County/Region)","Address6 (Country)","Address6 (Postcode)","Address7 (Home/Office)","Address7 (Domestic/Foreign)","Address7 (P.O. box)","Address7 (Details)","Address7 (Street number)","Address7 (City/Town)","Address7 (County/Region)","Address7 (Country)","Address7 (Postcode)","Address8 (Home/Office)","Address8 (Domestic/Foreign)","Address8 (P.O. box)","Address8 (Details)","Address8 (Street number)","Address8 (City/Town)","Address8 (County/Region)","Address8 (Country)","Address8 (Postcode)","Address9 (Home/Office)","Address9 (Domestic/Foreign)","Address9 (P.O. box)","Address9 (Details)","Address9 (Street number)","Address9 (City/Town)","Address9 (County/Region)","Address9 (Country)","Address9 (Postcode)","Address10 (Home/Office)","Address10 (Domestic/Foreign)","Address10 (P.O. box)","Address10 (Details)","Address10 (Street number)","Address10 (City/Town)","Address10 (County/Region)","Address10 (Country)","Address10 (Postcode)","Birthday (Date)","Birthday (Solar/Lunar)","Anniversary1 (date)","Anniversary1 (solar/lunar)","Anniversary2 (date)","Anniversary2 (solar/lunar)","Anniversary3 (date)","Anniversary3 (solar/lunar)","Blood type","Hobby","Ringtone type","Ringtone","Message ringtone type","Message ringtone","Photo file","Memo","Voice recognition","two-phone mode","Title","Middle name","Suffix","Department","Assistant name","Assistant telephone","Manager","Government ID","Account","Customer ID","Office location","Spouse","Children","Category","Additional information"

I imagine Evolution expects it to be in a different formation. Can someone point me out how Evolution expect this file to be? Then I could adjust it's columns accordingly. Or import it in a more direct way, if it's possible,

share|improve this question

1 Answer 1

up vote 2 down vote accepted

My solution to this problem was to read the csv using Python csv module and then dump the data as a vcard. A vcard can contain multiple contacts, just append them.

The script:

#!/usr/bin/python

# Read a Samsung backup csv and outputs a vcf file

import csv
import sys

def convert(filename):
    reader = csv.reader(open(filename, 'rb'))

    for row in reader:
        firstname = row[1]
        lastname = row[0]
        telephone = row[9]

        print 'BEGIN:VCARD'
        print 'VERSION:2.1'
        print 'N:' + lastname + ';' + firstname
        print 'FN:' + firstname + ' ' + lastname
        print 'TEL;HOME;VOICE:' + telephone
        print 'END:VCARD'

def main(args=sys.argv):
    if len(args) != 2:
        print "Usage:"
        print args[0] + " filename"
        return 1

    convert(args[1])
    return 0

if __name__ == '__main__':
    sys.exit(main())

Usage goes like:

./script.py myfile.csv > mycontacts.vcf 

Then import the generated vcf file into Evolution. Ugly, but works.

share|improve this answer
1  
You wanna submit your script to Code Review SE? It would do with some extra love. –  Tshepang Jul 18 '11 at 1:34
    
@Tshepang Nice suggestion, I'll give it a try :) –  Vitor Jul 18 '11 at 1:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.