Delete unnecessary and unwanted emails (Promotions, Social, Updates) in one go using Google Apps Script.
- Delete emails from Promotions, Social, and Updates tabs.
- Run directly inside Google Apps Script, no extra setup required.
- Safe: You can preview before deleting.
- Works with Gmail + Google Sheets (easy setup).
- Open Google Sheets.
- Create a new spreadsheet (name it e.g., Gmail Cleanzer).
- In your Sheet, click Extensions → Apps Script.
- This opens the Apps Script editor in a new tab.
- In the editor, create new files and copy-paste the code from this repo:
promotions_cleaner.gssocial_cleaner.gsupdates_cleaner.gsonopen.gs
- Replace the default
appsscript.jsonwith the one in this repo (this configures the custom menu).
- Click File → Save.
- Run any function (e.g.,
deletePromotions). - You will be prompted with a Google Authorization screen.
- You may see a warning: “Google hasn’t verified this app.”
- Click Advanced.
- Click Go to Gmail Cleanzer (unsafe).
- Google will ask for permissions to access Gmail.
- Click Allow.
👉 This only happens once during first-time setup.
- Go back to your Google Sheet.
- At the top menu bar, you should now see a new menu → 📧 Gmail Cleaner.
- From there, choose:
Delete PromotionsDelete SocialDelete Updates
- The script will process up to 500 emails per run and move them to Trash.
- Deleted emails go to Trash (auto-deleted permanently after 30 days).
- To stop midway, click the red stop button in Apps Script.
- Default: 500 emails per run (you can edit the script to change this).
Pull requests are welcome!
If you have improvements (better filters, scheduling, auto-cleanup), feel free to submit.
MIT License