Last edit


> === gmail2bbdb: ===

This is a page to put in some BigBrotherDataBase (BBDB) importer hacks.


Importing from LDIF

LDAP based tools and many address books understand LDIF format.

This file seems ancient; I am not sure how well it supports current BBDB.

Importing from XML

Norman Walsh published in 2003.

DaleSmith wrote this xsl file to convert from Sylpheed xml address format to bbdb: sylpheed2bbdb.xsl.

vCard Import


A 2014 simple importer for gmail name and emails:

gmail2bbdb will convert vCard file to ~/.bbdb , It has no dependency on any third party packages and is written in simple Lisp. So it will always works out of the box on any version of Emacs.

With bbdb-vcard.el:

This importer imports vCards version 3.0 of (almost) arbitrary content into BBDB.

On a file, a buffer or a region containing one or more vCards, use ‘bbdb-vcard-import-file’, ‘bbdb-vcard-import-buffer’, or ‘bbdb-vcard-import-region’ respectively to import them into BBDB.

Remember to call ‘bbdb-save’ after importing to save your data.

There are two known versions:

Cf. BbdbExporters#VcardExport for the export functionality of bbdb-vcard.el.

With bbdb-vcard-snarf-buffer:

I emailed this to Chris for inclusion, as his version 0.1 importer didn’t quite have this functionality:

    (defun bbdb-vcard-snarf-buffer ( buf )
      "Traverse BUF via regex.  Bbdb-snarf against each match."
      (let ((bbdb-current-point (point-min)))
        (switch-to-buffer buf)
        (goto-char (point-min))
        (while (re-search-forward "END:VCARD" nil (message "%s done" buf))
          (bbdb-vcard-snarf-region bbdb-current-point (point))
          (setq bbdb-current-point (point)))))

This requires vcard.el by NoahFriedman for the importer to work.


Based on this, Marcus Crestani wrote bbdb-vcard-import.el that makes it easy to import vCards into your bbdb. If the file ~/vCards.vcf contains the vCards you like to import, do:

M-x bbdb-vcard-import RET ~/vCards.vcf RET

See this thread on the bbdb-info mailinglist.

Importing from ~/.mailrc

Importing the ~/.mailrc file, it’s very simplistic, but did the trick for me, I hope it helps other people too. There is a slight limitation, in that it expects all aliases to be at the top of the file, but I guess that can be easily fixed.

    (defun my-import-dot-mailrc-to-bbdb ()
      "Imports the ~/.mailrc aliases into bbdb."
        (insert-file-contents (expand-file-name "~/.mailrc"))
        (goto-char (point-min)) ;; beginning-of-buffer (but faster)
    	 (concat "alias\\s-+\\(\\sw+\\(-\\sw+\\)?\\)\\s-+\"?"
    		 "\\([a-zA-Z0-9@. \t<>_-]*\\)\"?"))
          (eval '(bbdb-create-internal
    	      (buffer-substring (match-beginning 1) (match-end 1)) nil
    	      (buffer-substring (match-beginning 3) (match-end 3)) nil nil nil) )

Importing from CSV files & popular programs into bbdb 3

Use bbdb-csv-import from melpa or from and follow the simple instructions at the top of the file. Works with gmail, thunderbird, linkedin,, easily extensible to more. It is well supported.

This project was created due to too many bugs in the bbdb 2 importer below.

Importing from CSV files into bbdb 2

If you can manage to arrange your data in CSV (comma separated value) form, you can use lookout.el. This package allows for importing calendar and address data from CSV files. lookout.el is available from You also need csv.el which can be found at

For those too lazy to look through the code, the first line of your file should name each column. From the code:

Key1,Key 2,"Key3"
Value2a,Value2b,"Very long Value
    gets translated into
((("Key1" "Value1a") ("Key 2" "Value1b") ("Key3" "Value1c")) 
(("Key1" "Value2a") ("Key 2" "Value2b") ("Key3" "Very long Value

Then you define a variable to hold the mapping between the CSV columns and the BBDB fields. For example, I used:

    (defconst lookout-bbdb-mapping-table-maill-pl
      '(("lastname" "mname" "lname")
        ("firstname" "fname")
        ("company" "company")
        ("net" "email")
        ("phones" "phone1" "phone2")
        ("addr1" "addr1")
        ("addr2" "addr2")
        ("addr3" "addr3")
         "group" "group")
        ("notes" "Body"))
      "Mapping table, usable for input from the mailing list scraper,")

Now you can set the mapping table by using the variable lookout-bbdb-mapping-table and you are good to actually import the data with M-x lookout-create-bbdb

Importing from abook- and mutt-related formats

Right now I use mutt as my MUA and I want to switch to Gnus and BBDB (I have read Usenet News with Gnus many years). I know abook.

abook can read these fileformats:

abook can write these formats:

Right now I have my E-Mail addressbook in mutt aliases-file. So, maybe I’ll read it with abook and let it write it as VCard-format but CSV might be good intermediate format, too. There exist software that an import VCard to BBDB. And there is some software that can upload data from BBDB to GSM-phone via gnokii.


i was switching from mutt/abook to wanderlust/bbdb, so i came up with this code. hope you find it useful. – AnselmHelbig

    ;;; bbdb-snarf-abook.el --- import an abook-style addressbook into bbdb
    ;; Time-stamp: <2004-12-04 11:00:35 anselm>
    ;; this was developed for gnu emacs 21 and bbdb 2.34.cvs20030503-1
    ;; Author: Anselm Helbig <anselm [at] chemie [dot] fu-berlin [dot] de>
    (require 'bbdb)
    (require 'bbdb-com)
    (defun bbdb-snarf-abook (filename)
      "tries to parse an abook-style addressbook and writes the entries
    found directly into the bbdb. your .bbdb file may be empty, but has to exist."
      (interactive "fLocation of abook's addressbook: ")
        (let ((key) (value) (count 0))
          (set-buffer (find-file-noselect filename))
          (goto-char (point-min))
          (while (re-search-forward "\\[[0-9]*\\]\\s-*$" nil t)
        	(let ((name "") (address "") (city "") (zip "") (phone "") 
    	      (notes "") (email "") (workphone "") (mobile "") (fax "")
        	      (address-vector (vector "address" () "" "" "" ""))
        	      (address-vector-valid nil)
        	  (while (progn 
        		   (next-line 1) (beginning-of-line)
        		   (re-search-forward "\\s-*\\([^\\s-=]*\\)=\\(.*?\\)\\s-*$" (save-excursion (end-of-line) (point)) t))
    	    (if (not (string= (match-string 2) ""))
    		  (setq key (match-string 1))
    		  (setq value (match-string 2))
    		  (if (string= key "phone")
    		      (setq phone-list (cons (vector "home" value) phone-list)))
    		  (if (string= key "mobile")
    		      (setq phone-list (cons (vector "mobile" value) phone-list)))
    		  (if (string= key "fax")
    		      (setq phone-list (cons (vector "fax" value) phone-list)))
    		  (if (string= key "workphone")
    		      (setq phone-list (cons (vector "work" value) phone-list)))
    		  (if (string= key "address")
    			(aset address-vector 1 (cons value ()))
    			(setq address-vector-valid t)))
    		  (if (string= key "city")
    			(aset address-vector 2 value)
    			(setq address-vector-valid t)))
    		  (if (string= key "zip")
    			(aset address-vector 4 value)
    			(setq address-vector-valid t)))
    		  (set (read key) value))))
    	  (message "converting entry no. %d" (setq count (1+ count)))
    	   (if address-vector-valid (list address-vector))
          (message "abook's addressbook successfully imported."))))
    (provide 'bbdb-snarf-abook)

Importing from OS X system Address Book

I use Gnus as my mailer, but I live on a Macintosh. To get the system AddressBook data into the BBDB, I’ve written a short python script that uses the PyObjC? bridge to pull the relevant data directly. Share and enjoy!