Google Script Useful

Export Your Emails From Gmail into Excel or CSV

We receive hundreds of emails in a month in our Gmail. Students receive PDF ebooks, teachers receive meeting requests, job seekers receive offer letters, business men receive orders and proposals, internet guys receive news letters. But all those emails are scattered on their own way. You can not perform any analysis on them. For example, a business man can not calculate how many emails he/she has got from a particular person. You can not even plot any graph/chart on the raw emails. To do so you have to first get those information in an Excel sheet.

To  solve above problem we  have created an app script  which can export your emails to Google spreadsheet. Later you can download that as an Excel. 

Update: If your emails have not been categorized into different labels then you can smoothly use this script, it will work great for you. Otherwise, you can use our updated script which can even export the Gmail-labels into the spreadsheet. You can also export only those emails which are present under a specific label in Gmail.

Comparison among different versions:

Version Title Price Action
1.0 Export emails from Gmail to Excel or CSV $ 8.99
2.0 Export emails from Gmail to Excel or CSV with labels $ 9.99 Visit
3.0 Export emails from Gmail to Excel or CSV with labels & attachments $ 10.99 Visit
4.0 Export all emails from Gmail to Excel or CSV
(With advanced features, recommended for business users)
$38(Offer) Visit

If you still need to ask something urgently, then call us at +919778188086

How to do it

  • First purchase the product from above.
  • Open the Email Exporter Spreadsheet
  • After it loads you can find a "Export Emails" option in the menubar
  • Click on it and you will get two more options (a) Export last N emails (b) Export selected emails
  • Export last N emails needs no explanation. You can export up to last 200 emails.
  • Export selected emails can export only some particular emails.

How to provide the parameters

(a) Export last N emails
After you click this option, it will ask for the number of emails you want to export. You need to provide a number between 1-200. To export more than 200 emails go for Export selected emails option, where you can use Gmail search queries so that you can export unlimited emails in a batch of 200.

(b) Export selected emails
For this option you need to provide a Gmail search query. You can write queries even in the traditional way. For more about Gmail search quries you can refer this page. For Example: To get only those emails from support@tabgraf.com and has attachments, you can write query like: from: support@tabgraf.com has:attachment

After you provide the parameters it will take some seconds to clear the existing entries in the spreadsheet (if any). Then it will start exporting your emails. It will also show you the progress status like how much percentage has been completed.

  • chace

    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..

    • 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 ?

  • Tim Jasper

    Is it possible to modify this script to add a ‘gmail label’ column in the export?

    • 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

      • Tim Jasper

        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!!

  • Mike

    Is it possible to modify this script to add the BODY of the message? Thank you 🙂

    • 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 🙂

      • Francesco Benazzi

        Any idea on how to purge the HTML code? I would like to have only the plain text

        • Francesco Benazzi

          I found that in the spreadsheet I can use the regexreplace

          = regexreplace(I2,””,””)

          = regexreplace(J2,” “,””)

          How can I place it inside the script?

      • me

        use getPlainBody() will get the plain text

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

        • superb! Thanks man. I didn’t know this actually. I have never tried it practically but hope it works.

    • Kyle

      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

      • Thanks Kyle for helping Mike and for providing the exact solution. I will love to see you next time on my blog.

      • John

        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!

  • Marc

    By any chance would it be possible to extract around 5000 emails at once?

  • Juan

    It only allows exporting 200 emails max :-/

    • Not exactly true. In one batch you can export upto 200. So if you are exporting 700 emails then export them in 4 different batches.

  • shailesh

    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.

    • After authorization you need to again go to menu and click on Export selected emails.

  • Sales SecMan

    Thanks so much, it helps me a lot! 🙂

  • Lucy

    Hi,
    Is it possible to use this with Google Groups?
    Thanks

  • this is a good job for the convenience than ever before, with the excel spreadsheet.

    I think vendors should take a closer look

  • chh

    Does this work with Google Apps accounts? Thanks

    • Yes, it works !

  • Drez

    Where is my app? I just purchased it, and I have yet to receive my link for a download..

    • Press the “Get the app” button and provide the details to get the access for the app.

  • Export Emails button does not show up in my toolbar – just View Only text – ARGH!

  • David G. Larson

    Is this still working in Later September, 2016?

  • 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.