
How can I export all my gmail to CSV by sender/recipient - actfrench
Hi friends! It would be hugely helpful to me if I could export all my gmail correspondence to a CSV and see all correspondence associated with each email account. Web-based CRM tools allow me to see email correspondence by sender do but are too slow to navigate for my purposes.
======
niftich
You can get data out of Gmail programmatically by using their APIs; but
there's also a feature called 'Google Takeout' [1] that allows you to request
a single-file .mbox dump of all your email.

Neither of them give you what you want by themselves; additional processing is
required to get it into the format you want. The .mbox route is probably
easier for your use-case because it gives you the complete dataset, and you
don't have to write a client that makes several API calls.

Luckily the .mbox format has parsers in many languages that allow you to
navigate its structure (four random examples: [2][3][4][5]), Python's in their
standard lib, so you can do a simple script like this one, [6], and modifying
it slightly to pull the data you need out.

[1]
[https://support.google.com/accounts/answer/3024190?hl=en](https://support.google.com/accounts/answer/3024190?hl=en)
[2]
[https://docs.python.org/3.6/library/mailbox.html](https://docs.python.org/3.6/library/mailbox.html)
[3] [http://search.cpan.org/~dcoppit/Mail-Mbox-
MessageParser-1.51...](http://search.cpan.org/~dcoppit/Mail-Mbox-
MessageParser-1.5105/lib/Mail/Mbox/MessageParser.pm) [4]
[https://github.com/robertklep/node-mbox](https://github.com/robertklep/node-
mbox) [5] [https://github.com/bthomson/mbox](https://github.com/bthomson/mbox)
[6]
[https://gist.github.com/davidpelayo/139db134ca2337e966bb](https://gist.github.com/davidpelayo/139db134ca2337e966bb)

~~~
actfrench
Thank you!

------
DrScump
I've done a lot of Gmail extracts/harvests by using Mozilla Thunderbird, which
has better save-to-text capabilities, to intake Gmail, label, sift into
folders, and extract using its save-as-text capabilities.

~~~
actfrench
Thank you so much!

