How do I turn Gmail into a database?
February 3, 2011 8:31 AM   Subscribe

Is there a way to turn my Gmail account into a database? I have tons of valuable information in my 15 gigabytes Gmail box...can you recommend exciting ways of extracting it?

For example, is there a way to export the content of labelled mails (or even just links to labelled mails) to a Google Docs spreadsheet?

Or is there a hosted database system that I could direct particular emails towards in order to create much more intelligible records?

At the moment I use Gmail's labels feature as well as redirecting emails using Gmail plus+addressing (eg,,

I have hundreds of emails inside some of these labels and of course Gmail has no way to batch-redirect mails so they're currently stuck in there. From time to time I have asked an intern to go through these labels and transfer the information into a Google Doc spreadsheet by hand but there must be more automated and efficient ways to do this.

Any ideas? Thanks!
posted by skylar to Computers & Internet (6 answers total) 7 users marked this as a favorite
Well, Gmail does have POP and IMAP support. It transforms Gmail labels into IMAP folders, but I'm not sure how well that works.
posted by demiurge at 8:37 AM on February 3, 2011

Getting the text out is easy (see imapsync, e.g.) Getting the text into a form that is more useful could range from some simple scripts to the subject of a PhD dissertation, depending on what kind of information you are after.

If you want a database, the first question is what you want the schema to be. That is, what sort of information do you expect to find and what format would you like to see it in?
posted by sesquipedalian at 8:54 AM on February 3, 2011

If you're on a Mac you could use MailSteward. It's a full-featured front end that uses MySQL on the back end & lets you, store, organize, sort, analyze & otherwise manipulate your email archives.
posted by scalefree at 9:34 AM on February 3, 2011

imap or pop to Thunderbird, then you can export to CSV, or use a script to convert mbox to csv

posted by fozzie33 at 12:25 PM on February 3, 2011

If you (or someone you know) is comfortable with PHP and MySql: Gmail to MySql.
posted by blue_beetle at 12:54 PM on February 3, 2011

Response by poster: Sesquipedalian, the kind of format I'd like to see would be as follows:

1. I would forward a received email to

2. Anything with that label - addlabelhere - would be sent to the "addlabelhere" column in a spreadsheet

3. Every other label would result in its own column (I would be happy to work with a limited number of pre-defined label tags if needed).

4. The subject header of the forwarded mail would become the content of the row in that given column

5. The date would be appended automatically in another column
posted by skylar at 1:17 PM on February 3, 2011

« Older Optimizing an external hard drive   |   Who is Hipolito M. Wiseman? Newer »
This thread is closed to new comments.