How to Search Email Messages in Gmail for Downloading to Google Drive
The Save Emails addon will download your email messages and file attachments from Gmail to Google Drive automatically. It logs all the activity in a Google Spreadsheet so you can easily access all the saved files from a single location.
To get started, you need to specify the email messages that you wish to save to your Google Drive. You can download emails that belong to a particular label (or folder), emails that were received after a specific date (say all emails received in the last year), emails that are from a particular sender, emails that have particular words in the subject or message body and so on.
Install the Save Emails addon, go to the Google Spreadsheet, choose Addons > Save Emails and Attachments and then choose Create Rule. Here you need to specify the search criteria and all emails that match the rule will be saved to your Google Drive.
You have a list of all your Gmail labels (or folders) in the dropdown. You can select any label or choose Anywhere to download emails from anywhere in Gmail (including spam and trash folders).
If you, however, need to extract emails from multiple folders, you can put the label names in the “Has the words” box separated with the OR operator.
label:Personal OR label:Vacation OR label:inbox
If your label name contains spaces, remember to replace the spaces with hyphens. For instance, if you wish to search for “My Pictures” or “Personal Documents”, your query would be:
label:my-pictures OR label:personal-documents
By default, Save Emails will download all emails that match the search criteria. Thus if you choose to, say, download emails from Inbox, it will download all emails in the folder. You can, however, limit the addon to download only new emails. This can be done in multiple ways.
You can either specify the date in yyyy/mm/dd format in the “Received after” field and only messages received after that date will be downloaded.
Or you can use the newer_than search operator in the “Has the words” field. For instance, newer_than:10d would only download emails received in the last 10 days.
You can similarly search for emails that from particular senders.
For instance, if you wish to download all your payment receipts from Uber, you could put uber.com in the “From” field. Similarly, if you wish to download all your orders from PayPal or eBay, you can put (PayPal OR eBay) in the From field (notice everything is in brackets).
If you only need to process files that have attachments, put has:attachment in the “has the words” field.
Please refer to our detailed Gmail Search Tips & Tricks page to learn more about the available search operator for Gmail.
If you are more comfortable with the Gmail website, you can perform a search in Gmail and use the search string directly in your Save Emails addon.
Step 1: Go to Gmail, click the dropdown in the search box to expand the advanced search box and perform the search.
Step 2: Go the Search bar and copy the search string to the clipboard.
Step 3. Go to the rule definition inside the Save Emails window and paste the search string inside the “Has words” input field.
Thus you can easily create advanced search rules for Save Emails using the Gmail search function.
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.