7 Gmail Automation Scripts That Make Gmail Work the Way It Should

Sanket Bhatkar/ December 16, 2025/ Productivity

You deleted 47 emails yesterday. 

You’ll get 68 more today. 

And tomorrow? Another 70. 

That’s the never-ending cycle. All the unwanted subscriptions, their newsletters, ads, and promotions catch you up before you get to the important emails. You check, sort, respond, delta, archive, and repeat. Meanwhile, that one email that needs your constant attention sits untouched in your inbox. 

Your inbox just doesn’t need better labels or another assistant; it needs automation that works when you don’t. 

Gmail automation scripts aren’t just about clearing your inbox; they’re about reclaiming your lost hours and turning them into productive hours. You can now focus on only what matters. No more manual sorting, no more forgotten follow-ups or context switching every 10 minutes. 

Here are 7 Google Apps scripts that will transform how you manage Gmail.

1. Auto-Label and Archive by Sender Domain

What this script does: Automatically categorizes incoming emails based on sender domains and routes them to appropriate labels. Vendor emails go to a “Vendors” folder and get archived. Client emails get tagged but stay visible. Newsletter domains get their own treatment.  

Why it transforms your inbox: Vendor emails, newsletters, and recurring notifications pile up fast. The script instantly categorizes incoming mail by domain and removes clutter from your primary view. You stay focused on what matters without the noise. 

The technical approach: The script scans your inbox threads, extracts sender information from each message, and matches email domains against your predefined categories. When matches are found, it applies the appropriate labels using Gmail’s labeling API and archives threads that don’t need immediate attention. Set it to run hourly via time-based triggers. 

Business impact: Teams can save upto 45+ minutes daily on manual email sorting. 

2. Smart Follow-Up Reminder System

What this script does: Tracks emails tagged for follow-up and automatically resurfaces them if no response has been received within your specified timeframe. Emails return to your inbox with urgent flags after 3 days of silence.

Why it transforms your inbox: Deals slip through because you forget to follow up. This script automatically resurfaces conversations that need attention, ensuring nothing falls through the cracks. 

The technical approach: The script retrieves all threads with your “Follow-Up” label, analyzes the timestamp of the last message in each thread, and calculates elapsed time. For threads exceeding your threshold (typically 3 days), it moves them back to the inbox, marks them unread, and applies an urgent priority label for visibility. 

Business impact: Many sales teams report up to 23% higher response rates when follow-ups are consistent and timely. 

3. Auto-Archive Newsletters and Promotions

What this script does: Automatically archives promotional content and newsletters after a set period (typically 2 days) while protecting emails from VIP senders and any starred messages from being touched.  

Why it transforms your inbox: Newsletters have value, but not at the cost of inbox zero. This script archives promotional content after 2 days while protecting VIP senders and starred messages. 

The technical approach: Using Gmail’s search functionality, the script queries promotional and update categories for messages older than your threshold. It cross-references results against an array of whitelisted sender addresses and checks for starred status. Only threads that pass both filters get archived, ensuring important communications remain accessible. 

Business impact: It can help reduce inbox volume by 40-60% without losing critical communications. 

4. Auto-Respond to Internal Requests During Focus Time

What this script does: During designated focus hours (like 9 AM – 12 PM), it automatically sends polite holding responses to internal emails, letting colleagues know you’ll respond after your focus block ends. 

Why it transforms your inbox: Constant interruptions kill deep work. This script manages expectations automatically, protecting your most productive hours while keeping communication flowing.

The technical approach: The script checks the current hour against your focus time window. During active focus periods, it searches for recent unread emails from your company domain, creates draft responses with your availability message and alternative contact methods, sends them automatically, and applies a tracking label to prevent duplicate responses. 

Business impact: Knowledge workers report 2-3 hours of reclaimed focus time per day. 

5. Expense Receipt Auto-Forwarding and Labeling

What this script does: Automatically detects emails containing receipts, invoices, or payment confirmations, forwards them to your finance team with context, labels them appropriately, and archives them from your inbox. 

Why it transforms your inbox: Receipt management is tedious, busywork. This script automatically captures, forwards, and organizes expense-related emails so finance teams get what they need without manual intervention. 

The technical approach: The script searches for specific keywords in subject lines (“receipt,” “invoice,” ”payment confirmed”), filters for messages with attachments, forwards matching emails to your designated finance labels, and removes processed threads from your active inbox.

Business impact: Eliminates 90% of manual expense email handling, speeds up reimbursement cycles. 

6. Weekly Digest of Low-Priority Emails

What this script does: Batches low-priority emails throughout the week and delivers them in a single digest every Friday or Monday. All original emails get archived, keeping your inbox clean while ensuring you don’t miss anything.  

Why it transforms your inbox: Not every email deserves real-time attention. This script batches low-priority messages into a weekly review, so you stay informed without constant interruptions. 

The technical approach: The script retrieves threads from your “Low Priority” label, extracts subject lines and sender information from the first message of each thread, compiles this data into an HTML-formatted email digest, sends it to you at a scheduled time, and archives all processed threads to maintain inbox cleanliness. 

Business impact: Reduces email checking frequency by 35%, increases focus on high-value work. 

7. Smart Thread Closer for Resolved Conversations

What this script does: Automatically detects when email conversations have concluded (based on closing phrases like “thanks,” “perfect,” “sounds good”) and archives them with a “Resolved” label after the thread has reached a natural endpoint. 

Why it transforms your inbox: Conversations that end with “thanks” or “sounds good” don’t need to sit in your inbox. This script detects resolved threads and closes them automatically, keeping your view clean. 

The technical approach: The script analyzes the last message body in each inbox thread, searches for common closing phrases using pattern matching, validates that threads have sufficient back-and-forth exchanges (minimum 3 messages to avoid false positives), applies a resolution label for tracking purposes, and archives completed conversations while preserving full thread history. 

Business impact: Reduces inbox clutter by 30%, helps teams achieve inbox zero consistently. 

The Bigger Picture

Google App scripts are powerful, but they’re just the beginning. The real transformation happens when automation becomes part of your organisation’s DNA. 

Most teams implement one or two scripts and stop. That’s leaving 80% of the value on the table. The winners are the ones who build a complete email ecosystem, scripts that work together, triggered on schedules, integrated with other Google Workspace tools, and continuously optimized based on real usage patterns. 

That’s not a weekend project. It’s a strategic initiative. 

At Shivaami, we don’t just hand you code and walk away. We architect email automation strategies that scale across entire organizations. We integrate Gmail scripts with Google Sheets for reporting, Cloud Functions for advanced triggers, and AppSheet for no-code interfaces. We train your teams, set up monitoring, and ensure everything runs flawlessly.

Share this Post