

get all email threads that match label from Sheet Var label = sheet.getRange(1,2).getValue() Var ss = SpreadsheetApp.getActiveSpreadsheet() addItem('Extract Emails.', 'extractEmails') Then paste in the following code (this same code is here on GitHub): Rename the project and clear out the boiler plate code so your editor window is blank: If you are just looking at a single label with no relationship with other labels, then you can just type that label, e.g. Hence I need to write the label with a dash to show this relationship, with the parent label listed first, hence: “work-queries”. In this example I have a nested label, where I want email addresses from the label “queries” which belongs to the parent label “work”. The Google Sheet for this example is super simple for a change.Ĭell B1 is where we type the label that we want to extract emails from, and then on row 3 are the two column headings, Name and Email.
GMAIL EMAIL ADDRESS EXTRACTOR BY DATE HOW TO
How to use the Gmail Service with Apps Script and Google Sheets Step 1: Set up the Google Sheet I’ll share the code and walk through it with you. In this post, we’ll see how to setup a Google Sheet to extract all the email address for a specific Gmail label. Super tedious to do manually, but thankfully there’s a much quicker way using Apps Script.


Recently I needed to extract all of the email addresses for the hundreds of messages under this label. Everything flows through my Gmail account.īeing able to categorize all work enquiries or questions with a specific label, for example Queries (which I nest under my Work label) is one of the most useful features of Gmail. For me, email is at the very centre of my business.
