Pages

Welcome...

Gmail Message Sory by Size | Arrange Gmail message by Size | Sort your Gmail Messages by Size using Google Docs

Gmail Message Sory by Size | Arrange Gmail message by Size | Sort your Gmail Messages by Size using Google Docs

The idea is that your Google Docs will connect to your Gmail account and compute the size of every message that’s present in your mailbox. If it finds a bulky message (size > 1 MB), it will make a note of it in the spreadsheet.
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, forward it to a secondary email address and delete it from the primary Inbox to recover space.
That’s all the theory you should know, let’s now put this program into action:
  1. Create a copy of this sheet in your Google Docs account.
  2. A new Gmail Menu will appear in the sheet after about a minute. Select “Reset Canvas” from the Gmail menu to initialize your sheet.
  3. Accept the authorization screen and then choose Grant Access to let Google Docs access your Gmail Inbox. This is completely safe because your own Google Docs account is requesting access to your own Gmail account (see source code).
  4. Once the permissions have been granted, choose “Scan Mailbox” from the Gmail menu to start the scanning process.
Sit back and relax as the last step may take time depending on how big your Gmail mailbox is. Also, if the program is stuck or if you accidentally close the browser tab, open the same Google sheet, choose "Scan Mailbox" again and the script will resume scanning from where it left off.

Scan Gmail Messages with a trigger

If your Gmail mailbox is large, you can also set up a time-driven trigger to let the script 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.