Sort Gmail Messages by Size and Get Rid of Data Hogs

Sort Gmail Messages by Attachment Size

What we use is a simple Google Sheet that connects to Gmail, computes the size of individual messages and lists the bulky ones (size > 1MB) in the same Sheet. Here’s how you can get started:

  1. Create a copy of the Gmail Sort Google Sheet in your Google Drive.
  2. Click Scan Mailbox under the Gmail menu and authorize to let the script access your Gmail Inbox. It is an open-source Gmail Script that runs in your own Drive.

Sit back and relax as the script will pull the message list in the sheet. If the process stops for some reason, click Scan Mailbox again and the script will resume scanning from where it left off.

Once the sheet has a list of all the bulky message, you can sort the sheet by the Size column to find the big ones. Or use the Filter option (the Funnel icon) to find messages that are within a particular range (5 MB < size < 10 MB). Click the “View” link to open the corresponding message in Gmail, bulk auto-forward the big email to another email address or use the Save Emails add-on to download the big emails and attachments to your Google Drive.

Troubleshooting tips: If you get an error that says “Service invoked too many times for one day” or “Exceeded maximum execution time”, you may want to wait for some time before re-running the program. These are Google Apps Script limits to prevent abuse.


Sort Gmail Messages by Size with a trigger

If your Gmail mailbox is large, you can also set up a time-driven trigger to let the script run automatically without manual intervention. In this case, you can even close the browser tab and the script will run in the background. Here’s how:

  1. While the Google sheet is open, go to Tools -> Script Editor. On the next screen, choose Resources -> Current Script Triggers.
  2. Click “Add a New Trigger,” change the Event from “Spreadsheet” to “Time Driven” and set a minutes timer that triggers every 10 minutes.
  3. Save the trigger, authorize the script if it requires and close the sheet.


Sort Gmail by Subject

To sort your mails by subject, we will use a custom code to arrange the current set of emails that you are viewing.

If you are using any browser other than Chrome, then simply copy paste the below code to address bar and press Enter Key. For Chrome, first press the F12 key to enter Developer Tools and then click on Console tab. Now paste the below code and press enter. This code will only sort the current set of mails that you are viewing.

How to Search for Mails within Specific Date

Gmail by default sort mails by date. To find mails between specific dates in Gmail, you will have to do an advance search. Click on the arrow inside Gmail search box and then choose “Date within” search criteria. There is no field for “From” and “To” date to search however entering only one date and then selecting date within range will give same results.

How to Order Google Drive by Size

Your Gmail attachments use your Google Drive space allocation so you may find it easier to manage your Google Drive directly. The Storage view can be ordered by size in ascending or descending order.

  1. Open your Google Drive
  2. Select the numbers under Storage in the left panel
  3. Select Storage used in the top-right of the next screen to sort by file size in ascending or descending order

You can now manage your storage as you see fit, sorted from the largest to the smallest files or from the smallest to the largest files.

2. How to Gmail Sort by Size With Limits

In case you need to filter out and sort Gmail by s

In case you need to filter out and sort Gmail by size set within certain limits, follow these steps:

  1. Open your Gmail Account
  2. Ensure you’re on the primary inbox tab
  3. Click on the Search tab 
  4. Type larger_than:3MB smaller_than:12MB, with 3 and 12 being replaceable with the desired size
  5. Press Enter

All the emails holding a size larger than 3MB and smaller than 12MB will appear on the screen. You can also use these functions separately to search for the required array of mails. 

Additional Gmail Search Functions

Gmail is full of features that remain undiscovered, almost forever.

Here’s a list of functions and their use in Gmail:

  • Type older:2007/07/01 to search for emails older than the typed date
  • Type newer:2007/07/01 to search for emails after the classified date
  • Type from:name to search for received mail from a particular individual
  • Type to:name to search for sent mail of a specific individual
  • Type has:document, with ‘document’ being replaceable with the required attachment type, to search for emails with documents

Overall, Gmail offers a user-friendly interface that allows you to search for emails with attachments, pictures, larger sizes, smaller sizes, etc. So the next you get frustrated with your overflowing email and are confused with to filter and sort Gmail by size, remember the functions mentioned away to search the desired email lot, in a click. 

+ posts A passionate writer with bachelor’s in the field of English & Journalism. Other than being a bibliophile, some of her hobbies are travelling, photography and poetry.


Leave a Reply

Your email address will not be published.