One of the questions I get asked a lot is how to get information from incoming emails entered into a Google Spreadsheet. In this post, I’ll show you one implementation on how to do this with the gspread module in Python.

Getting Started with Our Parse Webhook

The first thing we need to do is tell your domain that SendGrid will handle the email on its behalf. Then we tell SendGrid where to post the data from the email:

Modify MX Records

Change the MX Records of your domain to point to This lets the registrar know that SendGrid will accept email messages on behalf of that domain.

Add Webhook URL

Once the email flows through us, we will parse out the components ( of the email and post it a URL of your choice.

My domain in this case is, and I’m pointing to a URL where my app is located. You can set the address of your application here: Make sure to check incoming email for spam so that we can get the spam score posted to our application.

Setting up the GSpread Module and Your Google Spreadsheet

Install the gspread module ( You can just pip install gspread or take a look at the other install options at the repo.

Next, make sure to create a Google Spreadsheet you want your data to be sent to.

Modify and Run the Code

Here is the code I created to get the From, Subject, and Spam Score of any email that goes to I created a quick Flask app with some functions to move around the spreadsheet.

Make sure to change the values of your Google login and spreadsheet name. Host this on your server and make sure to tell SendGrid to point here:

Meet Kunal, Developer Evangelist at-large for SendGrid and home-grown New Jersey hacker. He previously ran General Machines, which developed Deaftel - a phone service for the deaf that converts voice to text and text back into voice over a phone call. Since March 2013, Kunal has been working as a Developer Evangelist at SendGrid, helping enable developers to get the tools and resources they need to make awesome, creative stuff.