Skip to content

Instantly share code, notes, and snippets.

@michaelbrawn
Created November 29, 2015 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelbrawn/4b74c879d512743e8675 to your computer and use it in GitHub Desktop.
Save michaelbrawn/4b74c879d512743e8675 to your computer and use it in GitHub Desktop.
Archive Old Unread Gmail
function archiveInbox() {
// Every thread in your Inbox that is older than two days, and not starred.
var threads = GmailApp.search('label:inbox older_than:2d -is:starred');
for (var i = 0; i < threads.length; i++)
threads[i].moveToArchive();
}
@michaelbrawn
Copy link
Author

I've been using this for a while. https://www.johneday.com/422/time-based-gmail-filters-with-google-apps-script
Moving it to a gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment