Google Script Programming tricks Useful

Export Your Gmails into Spreadsheet With Their Labels

Just two weeks ago I had written an article about how to Export Your Emails From Gmail into Excel or CSV. It was really an unique apps script which requires a little effort to export emails into spreadsheet. Many people have already implemented it and got benefited.

Now I have slightly modified the previous script, added a new column for Gmail label. I am done with it and the newer version is available.

Update: We have released the latest version of Email Exporter app with its brand new website. All older versions are no more in use. Please visit emailexport.io to know more about it.

Comparison among different versions:

Version Title Price Action
1.0 Export emails from Gmail to Excel or CSV N/A Older Version
2.0 Export emails from Gmail to Excel or CSV with labels N/A Older Version
3.0 Export emails from Gmail to Excel or CSV with labels & attachments N/A Older Version
4.0 Export all emails from Gmail to Excel or CSV
(With advanced features, recommended for business users)
N/A Older Version
ProExport all emails from Gmail to Spreadsheet which can be downloaded as Excel, CSV or PDF
(With advanced features, recommended for business users)
Starts with $5Active
emailexport.io

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

Changes we did in our previous script

  • Our previous script was not able to export Gmail labels into a different column in the spreadsheet. But now it has been modified accordingly.
  • You can not export Emails present under a particular label (with Export last N emails option) in the old script, but our new script can do it easily.
  • Some other enhancements have been done in GUI to make it more attractive.

How to use it

Note: This is the instruction to the older versions of email export app. Go to emailexport.io for the updated version.

  • First purchase the product from above.
  • Open the Email Exporter Spreadsheet.
  • After it is completely loaded you will get a new menu option in the menubar called "Export Emails"
  • You will get two options to export, (a) Export last N emails (b) Export selected emails
  • In-case of Export last N emails you will get the following dialog

Export options

  • Simple choose the required label from the drop down  and provide a number between 1-200 to export. 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.
  • The functionality almost remains the same in our new script so you can obviously refer the previous article for any instruction you need

41 thoughts on “Export Your Gmails into Spreadsheet With Their Labels”

  1. Hari, this is an excellent script, but is it possible to increase the limits? I have thousands of emails I would like to extract. thanks

    1. No, it’s not possible to export 1000 of emails at a time, you have to do it in batch of 200s. It might show time out message if the threads size is too big. So I have deliberately kept the MAX limit as 200 to avoid such annoying message.

        1. Well, here is the trick. While giving the search query in the Spreadsheet just search for
          after:2013/07/11 before:2013/07/15
          you will get the mail between these dates. This way you can try different dates in different batches and export accordingly. This is just an example. You can even try other search queries.

          1. lol… hey sanmit, I haven’t kept this limit from my end. Google doc’s has kept a limit on maximum execution time for a script. So I have limited it to 200. I feel, if it more than that, you might get time out error.

          2. Duplicate one !!!!, means you have got some duplicate mails in your inbox ? If so, you have to kick them out after they are exported completely. You can’t do anything except having a sip of coffee during the mails are exported 😛

          3. am not so mych tech one.i exported 7,000 email but wana to kick out some duplicated email id,so asking your help ,is there any way or any tips and tricks

          4. but earler i had no idea to pur date like before or after so what mail i expoerted i ws deleted that in inbox again again

          5. Whoi….What a terrific idea. So now you are satisfied right ? I have already told you how to export that easily.

  2. Very useful script, but it seems like it exports every email in a conversation. -I did an export with the following search, and it exported emails from 2008!: “from:me has:attachment -invite.ics newer_than:2d”
    -Can the conversation-export be avoided?

  3. This is really helpful! Thanks for sharing this script! Is it possible to export the content of the emails as well?

  4. a VERY GREAT Script -)

    To export Lables choose Search Query and type “in:label_name”. I exported 1000 mails successfully.

    Very Recommended – Great Job !

    1. Tips for Author:
      – round percents completed (now shows like 20.55555559%)
      – I’m now aware problems with export of ths due to max execution time. I ran another script to export it took like 10mins to execute and finished OK. Here when I choosed to export 1000 I had to do several tries with date begin-end…

      1. Those scripts which export it in 10 minutes might have run 10 times in 10 minutes. On the contrary this script runs immediately and gives you the output, so the time is limited in this case. Anyway thanks for your suggestions.

  5. Cool script. It works. I have 3 questions. 1. How to remove duplicates after getting the list into the sheet. 2. How to tell if the script is done running? 3. Can you publish the source code to this script?

    I have over 100,000 emails in my inbox so I’m trying to extract every one of them and compile a contact list. I want to remove the duplicates of the from column.

    I noticed the popups each time it writes to the sheet but I did not see any notice that the script was done.

    Would be nice to have export option to sort on the from column and only export unique list of single email addresses.

    1. 1. To remove duplicates you can use the famous spreadsheet function UNIQUE. Simple click on a blank cell and type =UNIQUE(B1:B10)
      Here B1:B10 is just an example range, actually you can use your own range in which you gonna find the unique values.
      2. During export a pop up regularly comes to screen which tells the % completion of the process. When it reaches to 100% means the export is done.
      3. The source code is already embedded in the same spreadsheet. To view it go to Tools–>Script editor in the spreadsheet.

    1. I have already explained this in the discussion. You can use search query like after:2013/07/11 before:2013/07/15. This query will return values in between these days. Similarly you can use different Gmail search queries to fetch different result as per requirement.

  6. Hi, this is very useful. But I have requirement of downloading the mail contents too. Currently I receive inquiries from yellow pages website in the form of emails. The email has a set format with details name, Phone no., Data of inquiry, Time of inquiry and City. The script you have offered has only From, To, Subject, CC & BCC. Is it possible to update this script to extract the inquiries from mail contents?

    1. Glad to know that you used the script and felt it useful. Regarding your requirement, yes it can be done. It is completely specific to your requirement. I can write a program for you which can read your email and populate the details in the spreadsheet. The code will be completely different. As writing code is a time consuming process and you know that it takes a lot of testing and all, so I would suggest you to go through Our Services page. We provide such beautiful services with very reasonable price. I can design it for you as per your need.

  7. Awesome! Does exactly what I’m after. Great job putting it together, easy to follow instructions and saved me a lot of time.

Leave a Reply to Hari Cancel reply

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