Importando contatos CSV para o Evolution 3.0.2

3

Estou executando o Evolution 3.0.2 (empilhamento de uma instalação do Fedora 15). Eu tenho um arquivo CSV com alguns contatos. Este arquivo foi criado por um software da Samsung, ao fazer o backup de um telefone antigo que eu tinha.

Se eu for para File - > Import... - > Import a single file e selecione meu arquivo Eu estou dando três opções para File Type :

  1. Evolution CSV ou Tab (.csv, .tab)
  2. CSV ou tabulação do Mozilla (.csv, .tab)
  3. CSV ou guia do Outlook (.csv, .tab)

Eu tentei importar usando todas as três opções, mas nenhuma delas parece funcionar: o local de destino não foi modificado.

O arquivo gerado pela Samsung é bastante detalhado. Esta é a primeira linha:

"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"

Eu imagino que o Evolution espera que ele esteja em uma formação diferente. Alguém pode me mostrar como a Evolution espera que esse arquivo seja? Então eu poderia ajustar suas colunas de acordo. Ou importe de forma mais direta, se for possível,

    
por Vitor Py 17.07.2011 / 22:10

1 resposta

2

Minha solução para esse problema foi ler o csv usando o módulo csv do Python e depois descarregar os dados como um vcard. Um vcard pode conter vários contatos, basta anexá-los.

O 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())

O uso é como:

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

Em seguida, importe o arquivo vcf gerado para o Evolution. Feio, mas funciona.

    
por 18.07.2011 / 01:57

Tags