How can I use my Gmail contacts within Alpine/pine?
An alternate way of importing your Google contacts is using pull_contacts.py.
This script will:
- perform a GData query to retrieve all the contacts; and
- print them in alpine's addressbook format.
So, to add all of your Google contacts to the addressbook, simply:
python pull_contacts.py [email protected] >> .addressbook
The main advantage of this method over the one described by DaveParillo is the added support for non-latin1 characters. If you're like me and have a lot of people with accented letters in their names, this script is a God-send -- you won't have to go through the list manually replacing ? with the right latin1 letter.
Note that the script requires the GData libraries.
I don't think you can just 'reach out' and use them on the fly, but you can append them to your existing ~/.addressbook
- in GMail, choose 'Contacts', then 'Export' in the upper right corner
- choose 'Outlook CSV' & save
- open it in a spreadsheet
- delete first line, insert a column before the others
- Save As -> Text export (configurable)
- in the upcoming dialog choose:
- Separator: Tab
- Never Quote
- Save file
-
append this file to your .addressbook-file.
cat gmailfile.csv >> ~/.addressbook
You can use this short piece of PYTHON code to extract the relevant columns from the Google CSV (use Export.. on Google Contacts Website). It also takes care of the translation from UTF-16 to your ISO locale.
import io
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import csv
a=io.open("google.csv",'r',encoding="utf-16")
r=csv.reader(a,quotechar='"')
for b in r:
if b[28] <> "":
print "\t"+b[0]+"\t"+b[28]
Call it as in:
python google.py >~/.addressbook
I found a much easier method!
Go to your contacts in google, and copy the entire contacts (ie, two columns, with names in first, and address in second, leave the "Name" and "Details" row)
Now, go to your home folder, and unhide by Ctrl+h. Open the .addressbook file.
Simply paste and save.
Open your alpine, and check!
Most will not need the following step.
For formatting and aligning, you may first create one contact through alpine, and then open your addressbook file. you will see your entry. Then paste and separate through tab accordingly.