what do you do when your Gmail account storage is nearly full? You can either purchase additional storage space from Google – they charge $5 per year for 20 GB – or a cheaper alternative would be that you scan your Gmail mailbox for messages that contain large file attachments and delete (or forward) all the bigger messages and recover precious space.
The problem is how do you find these bulky messages in your mailbox when Gmail doesn’t offer an option to sort and filter messages by size?
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:
- Create a copy of the Gmail Sort Google Sheet in your Google Drive.
- 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.