How to Extract Email Addresses from your Gmail Messages
Acme Widgets Inc. has been in business for over 10 years and they have exchanged emails with thousands of customers and suppliers. The email messages are archived neatly in Gmail but most of the email addresses aren’t stored in Google Contacts. The company is now shifting office and they need to inform everyone via email of the office move.
The big task ahead is to extract all these email addresses from the Gmail mailbox and download them in a format, like CSV, that can be easily imported into the Google address book or a mailing list service like MailChimp.
Introducing Email Address Extractor, a Google add-on that sifts through all email messages in your Gmail account, extracts the email addresses and saves them in a Google Spreadsheet. It works for both Gmail and Google Apps accounts.
The Extractor can mine email addresses from a particular Gmail folder (label) or the entire mailbox. You can choose to extract emails of the sender, the recipient(s) and those in the CC list. The add-on can also parse the email’s subject and message body for email addresses. This is useful for extracting addresses from generic senders, like PayPal emails or contact forms, where the email addresses are contained in the message body.
- Install the Gmail Extractor add-on and grant the necessary permissions. The add-on needs access to your Gmail and also to Google Drive for saving the email list inside a Google Spreadsheet.
- Go to the addons menu inside the Google Spreadsheet, choose Email Address Extract and click Start to launch the extractor addon.
- Specify the search criteria and all emails that match the rule will be parsed by the extractor. You may use any of the Gmail Search operators to filter messages.
- Next select the fields (to, from, cc, bcc) that should be parsed for extracting emails (screenshot). The add-on can also pull names of the sender and recipients if they are available inside the message header.
Click the “Start” button and the extractor will start pulling emails into the spreadsheet. The entire process may take some time depending up on the size of your Gmail mailbox.
The Google sheet should remain open and the computer should be online during the extraction. If the connection is lost, or if the extraction process is interrupted for some reason, you can simply click the “Resume” button and the extractor will pick from where it left off earlier.
If you go back to Gmail, you’ll find a new label called Extracted. This keeps tracks of the emails that have been processed and can safely delete this label after all the email address have been parsed and extracted.
The Google Spreadsheet created by Email Extractor add-on has two sheets - All Emails & Unique Emails. The first sheet includes every single email found in your Gmail account while the second sheet is a cleaned up list sans any duplicate emails. This is the sheet you should use for building your address book.
The free version of the add-on is fully featured but it would only extract addresses from up to 500 email threads (a thread contains multiple email messages). The premium version (link) imposes no such restriction and it entitles you to 90 days of complimentary support.
Internally, it is a Google Script that uses the magic of Regular Expressions to pull email addresses from Gmail. The extracted email addresses are saved in a Google spreadsheet that can be used as input for sending personalized email messages through Gmail Mail Merge.
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.