topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 12:27 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: Script to sort your Gmail messages by size using Google docs  (Read 17233 times)

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
When my Gmail mailbox got to about 40% storage utilisation, I set about clearing out the large emails. I deleted those I didn't want to keep, but those I did had their bulky contents archived.
My search-and-archive process was:
  • identify those emails with documents attached or containing embedded images;
  • save the attachments/images to disk or Gdocs;
  • forward the containing emails - but now containing nothing - to myself, adding links or references to where embedded/attached items had been stored.
  • delete the original email and its contained/attached items.
Over time, using this method, I reduced my Gmail storage utilisation to 20%, and without losing/deleting any emails that I wanted to keep.

The process I used is an ironically manually intensive approach to cleaning out a sophisticated hi-tech computer data storage and retrieval system. It pained me to do it, as I really could have used something that automated aspects of the search-and-archive process to make it more efficient.
Today I came across this script. It seems to work, and I am running it now:
Sort your Gmail Messages by Size using Google Docs

eleman

  • Spam Killer
  • Supporting Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 413
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #1 on: April 19, 2012, 06:32 PM »
weehaa... muchos fantasticos

Thanks a ton, wifey managed to fill her gmail account. This will make clean-up much easier.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #2 on: April 19, 2012, 06:33 PM »
Thanks, I'm up at 5.5GB mainly due to lots of large Tiff attachments.

How long did it take? Slow here...
It stopped a couple of times but seems to be running okay now.

It's a bummer that you cant just remove attachments in gmail...
Tom

rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 2,192
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #3 on: April 19, 2012, 07:29 PM »
One of the most useful tools in a while  :Thmbsup:

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #4 on: April 19, 2012, 08:17 PM »
weehaa... muchos fantasticos
Yes, that's sort of what I said too.  
I am still running the script. It's doing quite a lot of work! - covering thousands of emails. It keeps getting timed-out by Google with the warning message:
Oops
Exceeded maximum execution time
When that happens I just restart it ("Scan mailbox" from the script's new Gmail dropdown menu) and it seems to continue from where it last left off in the spreadsheet.  
But when it's done, the spreadsheet should be a very useful tool for taking stock of your bloated emails.
You should then be able to deal with the top 20% of your biggest emails first, and apply the Pareto principle to removing 80% of your remaining Gmail bloat.

We shall see.
EDIT: I've just edited the thing per where the labnol post says Scan Gmail Messages with a trigger, so that the scan runs every 10 minutes instead of my having to manually start/restart he scan.
Smart thinking Batman.    :-[
« Last Edit: April 20, 2012, 01:06 AM by IainB, Reason: Modify per 10-minute interval scan-triggering. »

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #5 on: April 20, 2012, 05:36 PM »
Conclusion:
  • I left the script running all day and night yesterday, and then switched off the 10-minute trigger interval. (Note to self: Remember to switch such triggers off at some stage!)
  • The spreadsheet listed about 470Mb in total, saved in 135 sizeable emails ranging in size from 21Mb to 1.01Mb.
  • Just by deleting the 21Mb file (a Photoshopped image someone had sent me ages ago that I had forgotten about - oops!) and three 8Mb-sized files (containing attached images), my percentage storage utilisation fell from 20% to 19%.
  • I am now embarked on a progressive archive and deletion of the contents of the remainder of the population of 135 emails (i.e., not expunging the emails themselves, just the fat contents/attachments).
« Last Edit: April 20, 2012, 05:44 PM by IainB »

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #6 on: April 25, 2012, 11:25 AM »
Further results. My Gmail is now down to 14% full.

eleman

  • Spam Killer
  • Supporting Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 413
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #7 on: April 25, 2012, 11:27 AM »
BTW, google seems to increase gmail quotas from 7.5 to 10 GB, simultaneously with the google drive launch.

anandcoral

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 777
    • View Profile
    • Free Portable Apps
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #8 on: April 25, 2012, 11:52 AM »
I have been using Outlook Express in MAPI mode to clean up my GMail accounts from the early time when it had 2 GB quota, and still use it.

I download just the header of all mails from GMAil. It comes pretty fast in MAPI mode even from a 90% full GMail account, in less than 2/3 minutes. I can download headers of just Inbox or All_Mail or any other labeled mails. No timeout or so message, as just the header gets downloaded, which shows the from, subject, date and most important size of each mail.

I flag (which shows as starred in GMail) all those which are bigger or just drag them to GMail/Trash folder in OE which is similar to deleting mails in GMail. Please note that deleting mail by pressing delete key in OE will not work, you need to move/drag them to GMail/Trash folder.

Some of my GMail account which I use for all types of subscription, gets filled up too soon, as I do not check them regularly. So when ever GMail informs me about the quota full, I use OE to clean up.

Another reason of using OE instead of any other 3rd party app or web service is that the password is not given to any other app/service, even I do not save it.

Give it a try and you may be surprised by the speed and simplicity of it. You may use Outlook instead of OE and it should give same result, but I have never tried it.

Regards,

Anand

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #9 on: April 25, 2012, 12:01 PM »
I decided it was to time consuming for me, and I needed to do a back up of everything anyway, so I decided to use Mail Store to download all mail and then delete the older mail. Unfortunately mailstore gave a bunch of error messages which I haven't had time to look at yet so I'm stalled.

Saved by the bell :)
BTW, google seems to increase gmail quotas from 7.5 to 10 GB, simultaneously with the google drive launch.
Tom

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #10 on: April 25, 2012, 08:03 PM »
Hehe I am at 24Gigs of a 25 Gig quota!

It seems to be running now. Here goes!

Edit: It only found about 10 emails the first run before it timed out! What use is that?  I can do manual heuristics faster than that!

« Last Edit: April 25, 2012, 08:17 PM by TaoPhoenix »

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #11 on: April 26, 2012, 09:52 AM »
It only found about 10 emails the first run before it timed out! What use is that?  I can do manual heuristics faster than that!
Set the script to auto-trigger at 5 or 10 minute intervals (per thread above) and check the Gdocs spreadsheet the next day - that's what I did. You don't even have to have the spreadsheet open that way. All automated.    :Thmbsup:

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #12 on: April 26, 2012, 09:56 AM »
BTW, google seems to increase gmail quotas from 7.5 to 10 GB, simultaneously with the google drive launch.
Oops! That's why my utilisation was down to 14%!! The cap just grew a bit bigger, that's all.
I thought I hadn't deleted enough to knock it down to 14% yet!    :-[
I hadn't noticed the 2nd part of the message where it says:
14% full
Using 1497 MB of your 10240 MB


tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #13 on: April 26, 2012, 04:48 PM »
Oops! That's why my utilisation was down to 14%!! The cap just grew a bit bigger, that's all.
I thought I hadn't deleted enough to knock it down to 14% yet!    :-[
I hadn't noticed the 2nd part of the message where it says:

either way, we win :)
Tom

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #14 on: May 04, 2012, 11:45 AM »

I've been trying out this script. It gets to about 235 entries on the spreadsheet and then it stopped finding anything else.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #15 on: May 04, 2012, 03:33 PM »
I've been trying out this script. It gets to about 235 entries on the spreadsheet and then it stopped finding anything else.

is it that it keeps stopping?
- you have to restart it. Iain says above somewhere how he worked around it, but I didnt get that far myself...


EDIT/ mind you if you deleted 235 entries with an average of 10MB (??) you'd have a nice bit of space.
Tom

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #16 on: May 04, 2012, 04:37 PM »
At one point it quit finding new messages at all. And 90% of the ones it did had only 1.3 megs. And "No, 235 * 1.3 megs is still piddly."

I send scanned contracts all the time, they're always 10 megs, doesn't mean I want to delete that email.

Heh my work email box is 25 gigs at 96% full.  : )

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #17 on: May 04, 2012, 05:44 PM »
At one point it quit finding new messages at all. And 90% of the ones it did had only 1.3 megs. And "No, 235 * 1.3 megs is still piddly."

I send scanned contracts all the time, they're always 10 megs, doesn't mean I want to delete that email.

Heh my work email box is 25 gigs at 96% full.  : )

If you download all to an email client, and make a backup, couldnt you then start deleting the oldest mails?
(mind you that was my idea using mailstore but I think I have to make a second attempt there)
Tom

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #18 on: May 04, 2012, 06:09 PM »
I've been trying out this script. It gets to about 235 entries on the spreadsheet and then it stopped finding anything else.
is it that it keeps stopping?
- you have to restart it. Iain says above somewhere how he worked around it, but I didnt get that far myself...

Set the script to auto-trigger at 5 or 10 minute intervals (per thread above) and check the Gdocs spreadsheet the next day - that's what I did. You don't even have to have the spreadsheet open that way. All automated.    :Thmbsup:

To automate the script trigger:
  • 1. Go to the article: Sort your Gmail Messages by Size using Google Docs
  • 2. Go to the part with the subtitle: Scan Gmail Messages with a trigger
  • 3. To enable the trigger, follow the steps detailed there. (You can't "break" anything, so treat it as an experiment.)
  • 4. Leave the script running for a while (say) overnight. You don't have to be online for it to run.
  • 5. Check it to see your updated list of large emails.
  • 6. Disable the trigger, otherwise it will keep triggering the script forever.
« Last Edit: May 04, 2012, 07:31 PM by IainB, Reason: Minor correction. »

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #19 on: May 04, 2012, 06:10 PM »
I can delete them as is, I'd miss the searchability. I wish there was an app for "download all the attachments, print the email text itself to a PDF, throw all that into a folder".

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #20 on: May 04, 2012, 06:11 PM »
Iain you're smarter than this ol' sharp marble, so I dunno if I'll actually get around to doing that : )

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #21 on: May 04, 2012, 06:17 PM »
I can delete them as is, I'd miss the searchability. I wish there was an app for "download all the attachments, print the email text itself to a PDF, throw all that into a folder".
What I do:
I view each email shown in the spreadsheet, starting with the biggest.
If I want to keep the attachment:
(a) I save it to Gdocs (now Gdrive) and give it a useful/relevant filename;
(b) I get the link to that file as a Shared file.
(c) I select foward for the email, insert the filename and link in the text at at the top of the email, and untick the attachment box.
(d) Put my address as the "To" name for the email (I'm sending it to myself).
(e) send the email, now less any attachment.
(f) Delete the email with the attachment.

That way, you get to separate the email from the attachment, save them both, and keep them linked.

It's a bit tedious, so I do this in bits, over time. It's surprising what a dent you can make in your "fat" emails this way, and it makes for more orderly storage.
If you use the Gdrive app to sync to your PC (I recommend this), then you can have all the attached files (which are now detached and saved in Gdrive) backed up on your PC. If you want to do that, then select their Gdrive folders in the Gdrive sync app. (I sync all folders - the whole Gdrive - by default.)
The first time the sync runs, it takes a while (all files/folders selected get transferred to your PC), but after that it's not too busy.

Your email will thus eventually be just email with no/few attachments, and you can similarly back the email up using a client email package (e.g., Outlook) on your PC.
____________________________________________
WARNING:
  • Gdrive has virtual "folders" (they are really like Gmail labels  - "tags"), and you can place a file in several of these "folders". It's a great way to organise your files into categories. But there's always only one single copy of the file, no matter how many folders you have it in (unless you deliberately create a duplicate of it).
  • So, if you shuffle your files around in the folders on Gdrive or tick a file as being in more than one folder, then that will cause the sync app to save a duplicate of the file to each logical folder on your PC. All those duplicates could have the potential to become very confusing (e.g., which is the version you want to update offline?), a waste of disk space, and a bandwidth hog if you shuffle files around a lot whilst organising things.
  • So consider turning the sync app off until your shuffling has finished and experiment carefully to discover how offline update affects file updates to Gdrive after online sync.
« Last Edit: May 04, 2012, 07:39 PM by IainB, Reason: Amended text and added WARNING notes. »

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #22 on: May 04, 2012, 06:54 PM »
You're awesome, but we'll see.

Heh I have 87,000 messages in my *sent* box. Sky knows how many total! : )

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #23 on: May 04, 2012, 07:24 PM »
Heh I have 87,000 messages in my *sent* box. Sky knows how many total! : )
That's a lot.    :o
In my case, as soon as Gdocs enabled the file link capability in Gdocs some years back, I started using it to reduce my Inbox bloat - as detailed in my above post.
Every file that has an attachment that I receive gets this same archival treatment.
I press "forward", insert my email address, untick the attachment box and have an AHK script that types into the top of the email:
   For archives:
   File(s):
- and I just add the filename and link in Gdrive.
Then I press send, and delete the original email.
Fortunately I don't get too many such emails.
I would automate it further if I could. (Any ideas?)

As for sending, I rarely send an actual file attachment, just an email with a link to the file saved in Gdocs.
I think - but am not sure - that Gdrive could help to make this easier to do. Still experimenting with it though.

By the way, I have edited my previous post above and added a WARNING regarding the difference between Gdrive virtual "folders" and the logical folders that Gdrive sync turns those folders into on your PC. Potential duplication/confusion. (I'm sure I'm not the only person to have mentioned this to Google in their feedback form.)

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: Script to sort your Gmail messages by size using Google docs
« Reply #24 on: May 04, 2012, 07:26 PM »
I think I have over 160,000 in my total box. I inherited a colleague's email box as part of the total. Wheeee!   ;D :D

Edit: (Iain says:) " Fortunately I don't get too many such emails."

Heh 40% of my emails have attachments! : )
"If it doesn't have an attachment one of you two isn't working hard enough" - Me just now   :P