3 ms·
Here’s an example of how you might use Google Apps Script to bulk delete emails from Gmail: Steps: 1. Open Google Sheets (or any other Google app that support
by atum47 2y ago
Here’s an example of how you might use Google Apps Script to bulk delete emails from Gmail:
Steps:
1. Open Google Sheets (or any other Google app that supports Apps Script).
2. Open the Script Editor:
In Sheets, go to Extensions > Apps Script.
3. Write the Script:
function deleteOldEmails() {
var threads = GmailApp.search('older_than:1y'); // Modify query as needed
for (var i = 0; i < threads.length; i++) {
threads[i].moveToTrash(); // Move emails to trash
}
}
This example deletes emails older than one year (older_than:1y). You can modify the search query for different criteria (e.g., label:unread, from:specific@example.com, before:YYYY/MM/DD).
4. Save the Script.
5. Run the Script:
Click the play icon to run the script. It will ask for permissions the first time.
This method allows you to automate email management using custom queries. Would you like to proceed with something like this, or were you thinking of a different approach?