This tool allows you to eaisly pull down your gmail messages, scrape them for plain text, and save them in a csv. I personally use it to make email datasets for training machine learning models.
- install the dependencies found in
requirements.txt
- click on enable the gmail api here to download you credentials.json
- place credentials.json at the root
- when you first run the parser, you will be asked to authenticate your account, which will also create a pickle file with your account details
python gmail_parser.py
will by default pull down all of your emails and save it in emails.csv
-n n_msgs
pulls down the number of messages specified by n_msgs
-o path
saves the emails to the file specified by path
Each line of the csv is formatted name,address,subject,body
The body is lowercase and space delimitted. All non-ascii characters are removed.