google-csv2claws-mail.awk is a Gawk script for converting Google CSV files exported from Google Contacts to Claws Mail address book XML files.
google-csv2claws-mail.awk sends its output to stdout. The address book name
can be set by setting the NAME value. The default name is google-contacts
.
google-csv2claws-mail.awk -v NAME=val file.csv > file.xml
google-csv2claws-mail.awk is released to the public domain. It is likely that you will want to change how the Google contact data gets mapped to the Claws Mail address book.
The Claws Mail email client’s address book is located at
.claws-mail/addrbook/. The file addrbook--index.xml
, contains a list of
address books. The file attributesrc
contains a list of attributes, which
you can add-to or edit. The address books are XML files with the following
schema:
<?xml version="1.0" encoding="UTF-8"?>
<address-book name="[address-book-name]">
<!-- Zero or more persons -->
<person uid="[unique number]" first-name="[FName]" last-name="[LName]" nick-name="[NName]" cn="[Displayed Name]">
<address-list>
<!-- Zero or more addresses -->
<address uid="[unique number]" alias="[email alias]" email="[email address]" remarks="[additional info]" />
</address-list>
<attribute-list>
<!-- Zero or more attributes -->
<attribute uid="[unique number]" name="[a value in the attributesrc file]">
<!-- text value -->
</attribute>
</attribute-list>
</person>
<!-- Zero or more groups -->
<group uid="[unique number]" name="[group name]" remarks="[additional info]">
<member-list>
<!-- Zero or more members -->
<member pid="[person uid]" eid="[persons email address associated with this group]"/>
</member-list>
</group>
<!-- Zero or more folders -->
<folder uid="[unique number]" name="[folder name]" remarks="[additional info]">
<item-list>
<!-- Zero or more items -->
<item type="person|group|folder" uid="uid of person, group, or folder" />
</item-list>
</folder>
</address-book>
Your addrbook--index.xml
file should look something like:
<?xml version="1.0" encoding="UTF-8" ?>
<addressbook>
<book_list>
<book name="google-contacts" file="addrbook-000001.xml" />
</book_list>
<vcard_list>
</vcard_list>
<jpilot_list>
</jpilot_list>
<ldap_list>
</ldap_list>
</addressbook>
It is possible that your CSV is different, such as if you have a contact with more than one physical address. Also, newlines in a field, such as the address field, will show up in the CSV file.
- Name
- Given Name
- Additional Name
- Family Name
- Yomi Name
- Given Name Yomi
- Additional Name Yomi
- Family Name Yomi
- Name Prefix
- Name Suffix
- Initials
- Nickname
- Short Name
- Maiden Name
- Birthday
- Gender
- Location
- Billing Information
- Directory Server
- Mileage
- Occupation
- Hobby
- Sensitivity
- Priority
- Subject
- Notes
- Group Membership
- E-mail 1 - Type
- E-mail 1 - Value
- E-mail 2 - Type
- E-mail 2 - Value
- E-mail 3 - Type
- E-mail 3 - Value
- Phone 1 - Type
- Phone 1 - Value
- Phone 2 - Type
- Phone 2 - Value
- Phone 3 - Type
- Phone 3 - Value
- Address 1 - Type
- Address 1 - Formatted
- Address 1 - Street
- Address 1 - City
- Address 1 - PO Box
- Address 1 - Region
- Address 1 - Postal Code
- Address 1 - Country
- Address 1 - Extended Address
- Organization 1 - Type
- Organization 1 - Name
- Organization 1 - Yomi Name
- Organization 1 - Title
- Organization 1 - Department
- Organization 1 - Symbol
- Organization 1 - Location
- Organization 1 - Job Description
- Website 1 - Type
- Website 1 - Value
- Website 2 - Type
- Website 2 - Value
- Custom Field 1 - Type
- Custom Field 1 - Value