Google Script Useful

Export Your Emails From Gmail into Excel or CSV

Today, email has become an integral part of our life. They contain a lot of sensitive and valuable information. We receive hundreds of emails every month and in some cases beyond that.  But all those emails are scattered in their own way. You cannot perform analysis on them unless you gather the data points. For a strategic business decision, analysing emails also play a vital role. Lets say your customers send feedbacks via emails and your boss want to run a sentiment analysis on them to predict the overall reaction. To do so, you have to first get those information in an Excel sheet. To facilitate with the issue, there is a beautiful tool called emailexport.io which can help you to save your email data to Google Spreadsheet. Later you can download them as Excel or CSV.

emailexport.io

Extract data from emails to spreadsheet

This tool emailexport.io can extract various fields from your inbox like to, cc, bcc, subject, body etc. You can apply filters to export only targeted emails. For example, if you need to export emails received from a particular person, you can do that easily with the filtering options available. Select only required fields you want to see in the exported sheet. Each message will be stored as a single row with field values in separate columns. The email body is extracted as a textual data which is really needful when you do some operation on it.

Email fields

Available filters

Following filters are available for quickly narrow down your results.

  • Labels
    Select up to 4 labels from the dropdown list. Once you sign-in, the dropdown will show your labels in the choices.
  • Subject
    Enter words present in your subject
  • From and To email
    Provide the email address of the sender & receiver
  • Has the words and doesn't have
    Filter by words whether or not the email contains that word in the body
  • Has attachments
    Export emails with at least one attachment

  • Include chats
    Gmail inbox also has the chat messages. These are the messages which you talk to people in hangout. They won't be there in the exported data by default. In case you want to include them, just enable this filter.
  • Filter by date
    Filter emails within certain date range. Just a pick a start and end date within certain date range from the date picker. Isn't it easy ?
  • Advanced filters
    There are still some more filters which you would rarely use. Check this Gmail search operator page to learn more about advanced filters.

Email filters

Steps to export

  • Visit emailexport.io and login with Google
  • On the dashboard, click on "New export"
  • Select what you want to export (email fields or only email addresses). To export email fields like CC, BCC, subject, body etc. go for the first option. To export only email addresses of people go for 2nd option. The later is really helpful to build a email list out of your inbox.
  • Provide export name and other required field including filters if necessary and click "Submit"
  • You can now see your export running on the dashboard. Click on the row to see the live preview. Once the exported sheet is created, click on it to see the data extracted.

30 thoughts on “Export Your Emails From Gmail into Excel or CSV”

  1. Everytime I try to use this sheet it just says it experienced an error, even just trying to export that most recent message I received..

    1. Hey chace, I checked it again and it is working perfect for me. Can you tell me exactly when you see the error. Are you executing it from the menubar ?

    1. Thanks for the question. I modified the script as you have mentioned in your question. Now it can export Gmail labels into a separate column in the spreadsheet. It will be really helpful to all. Check it here

      1. Hi Hari. Sorry, only just noticed your update. Fantastic to see you have implemented this. I use gmail as a task manager (using Activeinbox.com). I can now print my task lists. This is very powerful as I can filter I as I would in Gmail to create printable lists. Great work!!

    1. Yes, why not ! But the body will be fetched as HTML. If you are populating the spreadsheet with HTML body, it will be fully cluttered.
      Moreover you can not read HTML messages unless you display it in webpage. If still you want, then go to script editor and add a new column. Very simple 🙂

        1. I found that in the spreadsheet I can use the regexreplace

          = regexreplace(I2,””,””)

          = regexreplace(J2,” “,””)

          How can I place it inside the script?

    2. sheet.getRange(“H”+lastEntry).setValue(messages[j].getBody());

      You gotta go in and change it in 3 places. Basically put column H as getBody and it will export the body of the email

      1. This works great. How can I only get a part of the message, not the whole body? I tried .substring (200,300), but it didn’t work. Any ideas? Thank you!

  2. Hi Hari,
    When I “Export selected emails”, after entering filter criteria, it prompts – “Authorization Required”. I clicks on “OK” but no update after that. Just Blank Page.

  3. It will be good tips to export email from gmail and i know most of the users are like this service and they are try to do this in more time. So thank you so much to give us good lesson.

Leave a Reply

Your email address will not be published. Required fields are marked *