A Google Apps Script (GAS) to keep your gmail inbox clean by archiving unneeded emails.
All you need is a browser and an Google account in order to use this script to clean your Gmail inbox. It would work on personal account as well.
If you noticed that not all emails gone away after running the script, you might have too many email in your inbox. Google have a restriction on how many emails the script can retrieve at a time. You might want to run the script multiple times or simply search "before:yyyy-mm-dd" (where yyyy-mm-dd is a date) and archive everything you found.
-
Create a new project
-
Go to the project settings and turn on the option to show 'appsscript.json'
-
Copy and paste the content from appsscript.json to the one in your project and save.
-
Copy and paste the code from cleanGmailInbox.gs to your project and save.
-
Run emailArchive function (should be selected by default) using the play button displayed when opening the .gs file.
-
Give permission to run the script.
-
To automate, go to Trigger on the left and set up a trigger to run once the emailArchive function regularly (i.e. once a day at 1 am)
Open up an issue here