Gmail + Google Sheets: inbox triage without chaos
Your inbox doesn’t get “busy.” It gets noisy. Important requests sink under promotions, random CCs, and threads that never should’ve reached you in the first place, so you end up scanning, re-reading, and second-guessing.
This Gmail triage automation hits small business owners first, because they’re the support desk and the sales desk. But marketing leads and ops managers feel it too, especially when “quick replies” turn into a daily two-hour tax.
This workflow sorts and labels emails with AI, drafts replies when appropriate, flags urgent messages fast, and logs everything to Google Sheets so you can search history without digging through your inbox.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Gmail + Google Sheets: inbox triage without chaos
flowchart LR
subgraph sg0["Flow 1"]
direction LR
n0["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/webhook.dark.svg' width='40' height='40' /></div><br/>📧 Gmail Webhook Trigger"]
n1@{ icon: "mdi:message-outline", form: "rounded", label: "📩 Get Email Details", pos: "b", h: 48 }
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/openAi.dark.svg' width='40' height='40' /></div><br/>🤖 AI Email Analyzer"]
n3@{ icon: "mdi:swap-horizontal", form: "rounded", label: "🚦 Priority Router", pos: "b", h: 48 }
n4@{ icon: "mdi:message-outline", form: "rounded", label: "🚨 High Priority Alert", pos: "b", h: 48 }
n5@{ icon: "mdi:swap-horizontal", form: "rounded", label: "🛡️ Spam Detector", pos: "b", h: 48 }
n6@{ icon: "mdi:message-outline", form: "rounded", label: "🗑️ Move to Spam", pos: "b", h: 48 }
n7@{ icon: "mdi:swap-horizontal", form: "rounded", label: "💬 Auto-Reply Detector", pos: "b", h: 48 }
n8@{ icon: "mdi:message-outline", form: "rounded", label: "📝 Create Reply Draft", pos: "b", h: 48 }
n9@{ icon: "mdi:message-outline", form: "rounded", label: "🏷️ Categorize Email", pos: "b", h: 48 }
n10@{ icon: "mdi:database", form: "rounded", label: "📊 Log to Spreadsheet", pos: "b", h: 48 }
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/webhook.dark.svg' width='40' height='40' /></div><br/>✅ Webhook Response"]
n6 --> n10
n3 --> n4
n3 --> n5
n5 --> n6
n5 --> n7
n1 --> n2
n2 --> n3
n10 --> n11
n8 --> n9
n9 --> n10
n7 --> n8
n7 --> n9
n4 --> n9
n0 --> n1
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n3,n5,n7 decision
class n10 database
class n0,n11 api
classDef customIcon fill:none,stroke:none
class n0,n2,n11 customIcon
The Problem: Inbox triage turns into a second job
If you handle even a modest amount of email, triage becomes the work behind the work. You open a message, decide if it matters, decide how urgent it is, choose a label (or forget), and then try to remember if you should reply now or later. Multiply that by 30 or 60 emails a day and you’re burning real time, not just “a few minutes.” Worse, you miss the one message that actually mattered because it looked like everything else at a glance.
The friction compounds. You can’t fix it with “better habits” forever.
- Urgent requests hide in plain sight, so you spot them late and scramble.
- Labels are inconsistent (or unused), which means search and follow-up are unreliable.
- Spam and low-value promos still get read because they arrive like everything else.
- Replying takes longer than it should because you keep retyping the same structure.
The Solution: AI-driven triage, labels, drafts, and a Sheets log
This workflow turns Gmail into a lightweight ticketing system, without forcing you to switch tools. When a new email arrives, n8n pulls the email details, sends the content to an AI analysis step, and makes a few decisions based on what the message is actually saying. Priority messages can trigger an alert email so they’re hard to miss. Suspected spam can be tagged and handled automatically. If the email looks like it needs a response, the workflow creates a reply draft in Gmail (so you stay in control). Then it applies consistent labels and records the result to a Google Sheet for a clean, searchable history.
The workflow starts with an incoming Gmail webhook, then fetches the full message details. AI analyzes intent and urgency, and simple routing decides what happens next. Finally, labels get applied, drafts get created when needed, and the interaction is logged to Google Sheets.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you get about 50 emails a day and spend maybe 2 minutes per message just deciding “what is this and what do I do with it.” That’s roughly 100 minutes daily, or about 8 hours a week, before you’ve done any real work. With this workflow, the “decide and sort” part happens automatically: the trigger fires instantly, AI categorizes in under a minute, and you only open what’s labeled URGENT/IMPORTANT or what has a draft waiting. You still review, but the scanning disappears.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Gmail for reading, labeling, and drafting replies.
- Google Sheets to store a searchable email log.
- OpenAI API key or Anthropic API key (get it from platform.openai.com or console.anthropic.com)
Skill level: Intermediate. You’ll connect OAuth credentials, paste an API key, and tweak a few routing rules.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A new email triggers the workflow. The webhook catches incoming mail events, so triage starts as messages arrive (instead of when you remember to check).
The workflow fetches the full email details. n8n pulls the message content from Gmail, so the AI step has the subject, body, and metadata it needs to make a decent call.
AI reads and classifies the message. The analysis determines urgency, flags likely spam, and identifies emails that should get a response draft. Then simple “if/else” routing decides which actions to run.
Actions happen in Gmail and Sheets. Priority alerts can be sent, spam can be marked, reply drafts can be created, and labels are applied consistently. Finally, a Google Sheets row is added so you have a running log you can filter and share.
You can easily modify the label set to match your team’s categories, or change what “urgent” means based on keywords and sender domains. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Webhook Trigger
This workflow starts when Gmail pushes a webhook event to n8n.
- Add and open 📧 Incoming Gmail Hook.
- Set HTTP Method to
POST. - Set Path to
gmail-webhook. - Set Response Mode to
responseNodeso the flow returns from ✅ Return Webhook Reply.
Step 2: Connect Gmail and Fetch Email Details
The webhook payload provides a message ID, which is used to fetch full email data.
- Open 📩 Fetch Email Info and confirm Operation is
get. - Set Message ID to
{{ $json.message.data.messageId }}. - Credential Required: Connect your gmailOAuth2 credentials.
Step 3: Set Up AI Analysis
The AI node classifies each email and returns a structured JSON response used for routing.
- Open 🤖 Analyze Email Content.
- Set Model to
gpt-4. - Set Prompt to the full template provided, including the embedded expressions:
{{ $node['📩 Fetch Email Info'].json.payload.headers.find(h => h.name === 'From').value }},{{ $node['📩 Fetch Email Info'].json.payload.headers.find(h => h.name === 'Subject').value }}, and{{ $node['📩 Fetch Email Info'].json.snippet }}. - Credential Required: Connect your openAiApi credentials.
0.3 and Max Tokens at 1000 to preserve consistent JSON output.Step 4: Configure Routing and Gmail Actions
The flow branches based on the AI response to alert, mark spam, draft replies, and label emails.
- In 🚦 Route by Priority, set the condition Left Value to
{{ JSON.parse($json.choices[0].message.content).priority }}and Right Value tohigh. - In 🚨 Send Priority Alert, set Subject to
🚨 High Priority Email Alertand keep the Message field with its dynamic expressions for From, Subject, Summary, Action, and Gmail link. - In 🛡️ Identify Spam, set Left Value to
{{ JSON.parse($node['🤖 Analyze Email Content'].json.choices[0].message.content).category }}and Right Value tospam. - In 🗑️ Mark as Spam, set Operation to
modifyand add gmailOAuth2 credentials. - In 💬 Detect Reply Need, set Left Value to
{{ JSON.parse($node['🤖 Analyze Email Content'].json.choices[0].message.content).action_needed }}and Right Value toreply. - In 📝 Draft Reply Message, set Resource to
draft, Subject toRe: {{ $node['📩 Fetch Email Info'].json.payload.headers.find(h => h.name === 'Subject').value }}, and Message to{{ JSON.parse($node['🤖 Analyze Email Content'].json.choices[0].message.content).suggested_response }}plus the review footer. - In 🏷️ Apply Email Labels, set Operation to
modifyand add gmailOAuth2 credentials.
Step 5: Record Results and Respond to the Webhook
The final steps log the analysis to Google Sheets and return a JSON response to the webhook caller.
- Open 📊 Record to Sheet and set Resource to
spreadsheetand Operation toappendOrUpdate. - Credential Required: Connect your Google Sheets credentials (the node currently has none configured).
- Open ✅ Return Webhook Reply and keep Respond With set to
json. - Ensure the Response Body includes expressions like
{{ JSON.parse($node['🤖 Analyze Email Content'].json.choices[0].message.content).category }},{{ JSON.parse($node['🤖 Analyze Email Content'].json.choices[0].message.content).priority }},{{ $node['📩 Fetch Email Info'].json.id }}, and{{ JSON.parse($node['🤖 Analyze Email Content'].json.choices[0].message.content).action_needed }}.
Step 6: Test and Activate Your Workflow
Validate the end-to-end flow before enabling it in production.
- Click Execute Workflow and send a test webhook payload that includes a valid
messageId. - Confirm 📩 Fetch Email Info retrieves the email and 🤖 Analyze Email Content returns a JSON response.
- Verify the expected branch executes: high priority emails trigger 🚨 Send Priority Alert, spam triggers 🗑️ Mark as Spam, and reply-needed emails create a draft in 📝 Draft Reply Message.
- Check 📊 Record to Sheet for a new row and confirm ✅ Return Webhook Reply returns a success JSON payload.
- When satisfied, toggle Active to enable the automation.
Common Gotchas
- Gmail OAuth credentials can expire or be missing scopes. If things break, check the n8n Credentials screen first and confirm you allowed gmail.readonly, gmail.modify, and gmail.compose.
- If you’re using Wait nodes or external processing, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Google Sheets often fails for boring reasons: wrong spreadsheet ID, missing share access, or writing to a protected range. Confirm the connected Google account can edit the sheet you chose.
Frequently Asked Questions
About 45 minutes if your Google credentials are ready.
No. You’ll connect accounts, add an API key, and adjust a few rules. The hardest part is usually getting Gmail OAuth set up cleanly.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI or Anthropic API usage, which is usually a few dollars a month for typical inbox volume.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you should. Update the AI analysis instructions in the “Analyze Email Content” node to include your categories, then adjust the conditions in “Route by Priority,” “Identify Spam,” and “Detect Reply Need” to match how you want messages handled. Common customizations include VIP sender rules, keyword-based urgency (like “refund” or “contract”), and separate labels for leads vs. support.
Most of the time it’s OAuth scopes or an expired consent. Reconnect the Gmail credential in n8n and confirm it includes gmail.readonly, gmail.modify, and gmail.compose. If you’re using a Google Cloud project, also verify the OAuth consent screen is published (or your user is added as a test user) and that the redirect URI matches your n8n domain.
A lot, as long as your Gmail and AI limits are reasonable. On n8n Cloud, your cap is mainly monthly executions (Starter and above increases this), while self-hosting depends on your server. Practically, most small teams can run this all day without issue; if you’re processing thousands of emails, you’ll want batching and stricter spam/priority filters to keep AI calls under control.
Often, yes, because this workflow isn’t just “if email then add row.” You’re doing branching logic (priority vs. spam vs. draft), labeling, and optional alerts, and n8n handles that complexity without turning every condition into an extra paid step. n8n also gives you the self-host option, which is a big deal if your inbox volume spikes. Zapier or Make can still be fine if you only want a basic Gmail → Sheets log and nothing else. If you want help choosing, Talk to an automation expert.
Once this is running, your inbox stops being a guessing game. You’ll see what’s urgent, what’s noise, and what’s waiting on a draft, with a clean Google Sheets history to back it up.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.