OpenOffice
Addressbook conversion:
- csv2addressbook.pl Import Becky, Thunderbird or Kmail address books
+ csv2addressbook.pl Import Becky, Thunderbird, Kmail Gmail address books
eud2gc.py Convert Eudora address book to Gnomecard
kmail2claws-mail.pl Import a Kmail address book (KDE2)
kmail2claws-mail_v2.pl Import a Kmail address book (KDE3)
* csv2addressbook.pl
WHAT IT DOES
- This perl script will import a Becky, Thunderbird and Kmail address
- book.
+ This perl script will import a Becky, Thunderbird, Kmail and Gmail
+ address book.
HOW TO USE IT
(You must run claws-mail at least once before running this script.)
WARNING: Kmail/Kaddressbook has a bug whereby it exports badly
formatted CSV if the values are quoted.
+ Gmail
+ -----
+ In the Gmail web interface you need to export your address book
+ as Outlook CSV format.
+
+ Run the script with the following options:
+
+ perl csv2addressbook.pl --type=gmail --csv=/full/path/to/file.csv
+
+ Addtionally you can use the option '--name="My address book"', if
+ you don't use this option the new Claws address book will be
+ called 'gmail address book'.
+
You can also run the script with '--help' to get a brief usage message.
Contact: Paul Mangan <paul@claws-mail.org>
# Thunderbird >= 2.0.0.6
# Kmail >= 1.9.7 / Kaddressbook >= 3.5.7
# ** kmail bug: can export badly formatted csv **
+# Gmail
#
# Becky: full export with titles
# thunderbird: export as 'comma separated'
# kmail/kaddressbook: Export CSV list
+# gmail: export Outlook format
###
my $quote_char = '"';
my $bookname = '';
my $iNeedHelp = '';
-my $known_types = qr/^(?:becky|thunderbird|kmail)$/;
+my $known_types = qr/^(?:becky|thunderbird|kmail|gmail)$/;
GetOptions("type=s" => \$type,
"csv=s" => \$csvfile,
'Organisation','Department','Note','Homepage','Profession',
'Assistant\'s Name','Manager\'s Name','Partner\'s Name',
'Office','IM Address','Anniversary','Blog');
+my @gmail_fields = ('Name','E-mail Address','Notes','E-mail 2 Address',
+ 'E-mail 3 Address','Mobile Phone','Pager','Company',
+ 'Job Title','Home Phone','Home Phone 2','Home Fax',
+ 'Home Address','Business Phone','Business Phone 2',
+ 'Business Fax','Business Address','Other Phone','Other Fax',
+ 'Other Address','junk');
if (grep m/claws-mail/ => `ps -U $ENV{USER}`) {
die("You must quit claws-mail before running this script\n");
Usage:
$script [OPTIONS]
Options:
- --help Show this screen
- --type=becky|thunderbird|kmail Type of exported address book
- --csv=FILENAME Full path to CSV file
- --name="My new address book" Name of new Claws address book (optional)
+ --help Show this screen
+ --type=becky|thunderbird|kmail|gmail Type of exported address book
+ --csv=FILENAME Full path to CSV file
+ --name="My new address book" Name of new Claws address book (optional)
~;
exit;
}
return("Thunderbird address book");
} elsif ($type eq "kmail") {
return("Kmail address book");
+ } elsif ($type eq "gmail") {
+ return("gmail address book");
}
}
sub check_fields {
if ($type eq "becky") {
if ($#csvfields != $#becky_fields) {
- die("ERROR:\n\tNot enough fields!\n"
+ die("ERROR:\n\tInvalid field count!\n"
."\tYou need to do a Full Export With Titles\n");
}
} elsif ($type eq "thunderbird") {
if ($#csvfields != $#tbird_fields) {
- die("ERROR:\n\tNot enough fields!\n"
+ die("ERROR:\n\tInvalid field count!\n"
."\tProblem with your exported CSV file\n");
}
} elsif ($type eq "kmail") {
if ($#csvfields != $#kmail_fields) {
- die("ERROR:\n\tNot enough fields!\n"
+ die("ERROR:\n\tInvalid field count!\n"
+ ."\tProblem with your exported CSV file\n");
+ }
+ } elsif ($type eq "gmail") {
+ if ($#csvfields != $#gmail_fields) {
+ die("ERROR:\n\tInvalid field count!\n"
."\tProblem with your exported CSV file\n");
}
}
return ('0','1','3','2','4','5','38');
} elsif ($type eq "kmail") {
return ('2','1','6','0','28','34');
+ } elsif ($type eq "gmail") {
+ return('0','0','0','0','1','2');
}
}
return(@tbird_fields);
} elsif ($type eq "kmail") {
return(@kmail_fields);
+ } elsif ($type eq "gmail") {
+ return(@gmail_fields);
}
}