Gmail + Google Sheets, labeled inbox and logged leads
Your inbox is where good opportunities go to die. A new message lands, you skim it, you mean to respond, and then it gets buried under “quick questions” and notifications.
This Gmail leads logging automation hits agency owners and marketing managers hardest, because every missed follow-up costs real revenue. But consultants feel it too when collaboration requests slip through the cracks. The goal is simple: label every new email correctly, prep a reply, and log leads without you touching a thing.
You’ll see how the workflow routes messages into four categories, drafts or sends replies based on the type, and keeps a clean Google Sheets record for the leads you actually want to track.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Gmail + Google Sheets, labeled inbox and logged leads
flowchart LR
subgraph sg0["Gmail Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "Gmail Trigger", pos: "b", h: 48 }
n1@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If", pos: "b", h: 48 }
n2@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model", pos: "b", h: 48 }
n3@{ icon: "mdi:swap-vertical", form: "rounded", label: "Name Found", pos: "b", h: 48 }
n4@{ icon: "mdi:swap-vertical", form: "rounded", label: "Name Not Found", pos: "b", h: 48 }
n5@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model1", pos: "b", h: 48 }
n6@{ icon: "mdi:message-outline", form: "rounded", label: "Label - Agency Lead", pos: "b", h: 48 }
n7@{ icon: "mdi:message-outline", form: "rounded", label: "Label - Course Request", pos: "b", h: 48 }
n8@{ icon: "mdi:message-outline", form: "rounded", label: "Label - Paid Collaborations", pos: "b", h: 48 }
n9@{ icon: "mdi:message-outline", form: "rounded", label: "Label - Miscellaneous", pos: "b", h: 48 }
n10@{ icon: "mdi:robot", form: "rounded", label: "Message a model", pos: "b", h: 48 }
n11@{ icon: "mdi:message-outline", form: "rounded", label: "Create a draft", pos: "b", h: 48 }
n12@{ icon: "mdi:robot", form: "rounded", label: "Name Extractor", pos: "b", h: 48 }
n13["<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/merge.svg' width='40' height='40' /></div><br/>Single Intro Line"]
n14@{ icon: "mdi:swap-vertical", form: "rounded", label: "Reducing content before LLM", pos: "b", h: 48 }
n15@{ icon: "mdi:robot", form: "rounded", label: "AI-Classification & Sentimen..", pos: "b", h: 48 }
n16@{ icon: "mdi:message-outline", form: "rounded", label: "Standard Answer", pos: "b", h: 48 }
n17@{ icon: "mdi:message-outline", form: "rounded", label: "Standard Answer 2", pos: "b", h: 48 }
n18@{ icon: "mdi:database", form: "rounded", label: "Update DB", pos: "b", h: 48 }
n1 --> n3
n1 --> n4
n3 --> n13
n0 --> n12
n12 --> n1
n4 --> n13
n10 --> n11
n2 -.-> n12
n13 --> n14
n17 --> n18
n5 -.-> n15
n6 --> n10
n7 --> n16
n8 --> n17
n14 --> n15
n15 --> n6
n15 --> n7
n15 --> n8
n15 --> n9
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 n0 trigger
class n10,n12,n15 ai
class n2,n5 aiModel
class n1 decision
class n18 database
classDef customIcon fill:none,stroke:none
class n13 customIcon
The Problem: Your Inbox Isn’t a Lead System
Most inboxes are treated like a to-do list, a CRM, and a ticket queue all at once. That’s where things start breaking. A collaboration email looks like a normal “hello,” so it sits unread. A course inquiry gets a thoughtful reply… three days late. Meanwhile, you are wasting mental energy re-reading the same threads just to remember what you already decided. It’s not the big tasks that hurt. It’s the constant switching, the little decisions, and the slow drip of missed follow-ups that quietly costs you work.
The friction compounds. Here’s where it usually goes wrong.
- You label emails when you remember, which means labels stop being trustworthy after about a week.
- Hot leads and low-priority messages land in the same place, so you end up reacting instead of prioritizing.
- Drafting replies from scratch takes “just a few minutes,” then adds up to about 2 hours a week.
- Even if you track leads in a sheet, updating it manually is easy to skip when you’re busy.
The Solution: Classify, Label, Draft, and Log Automatically
This workflow watches for new unread Gmail messages, then handles the boring-but-critical inbox work for you. When a message arrives, it first tries to pull the sender’s name so your replies don’t feel robotic. Next, an AI classifier sorts the email into one of four categories (Agency, Course, Collaboration, or Misc). Based on that category, the workflow applies the right Gmail label immediately. Then it takes the correct action: for “Agency” it prepares a draft reply in Gmail for you to review, for “Course” it can send an auto-reply, and for “Collaboration” it sends a response and logs the lead in Google Sheets. You finish the day with a labeled inbox and a lead list that’s actually current.
The workflow starts with a Gmail trigger that detects unread messages. AI then extracts a name and classifies the topic using a prepared payload that includes your greeting line. Finally, Gmail handles the label plus reply behavior, and Google Sheets gets updated for collaboration leads so your follow-ups don’t rely on memory.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you receive 25 new inbound emails a day. If you spend only 2 minutes each to read, decide a label, and start a reply, that’s about 50 minutes daily, plus the “where did I put that?” time later. With this workflow, the trigger runs instantly, labeling happens in the background, and you only touch what needs a human decision (like reviewing agency drafts). Realistically, you’ll spend maybe 10 minutes a day scanning labeled buckets and approving the few drafts that matter.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Gmail for monitoring, labeling, drafts, and replies
- Google Sheets to store collaboration leads centrally
- OpenAI API key (get it from your OpenAI dashboard)
Skill level: Beginner. You’ll connect accounts, create four Gmail labels, and paste in label IDs and your sheet details.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
New unread email triggers the workflow. The Gmail trigger watches your inbox and pulls in the message as soon as it arrives, so you’re not relying on periodic manual checks.
A greeting line is built automatically. The workflow extracts a sender name when possible, then chooses either a named greeting or a generic one. Both options merge into a single intro line, so downstream AI always has something clean to work with.
AI classifies the email into the right bucket. A prepared payload is sent to the classifier, which routes the message into Agency, Course, Collaboration, or Misc. That decision controls everything that follows, including which Gmail label gets applied.
Replies and logging happen based on category. Agency emails get an AI-generated draft created inside Gmail for review. Course and collaboration emails can receive auto-replies, and collaboration contacts are appended to Google Sheets so you have a running list of partner opportunities.
You can easily modify the four categories to match your business, or change which categories get drafts versus auto-replies based on your comfort level. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Gmail Trigger
Set up the workflow to watch your inbox for new unread emails and start the automation.
- Add and open Gmail Inbox Watcher.
- Set Read Status to
unread. - Set Poll Times to
everyMinute. - Credential Required: Connect your
gmailOAuth2credentials.
Step 2: Connect Gmail and Google Sheets
These nodes write labels, drafts, replies, and lead updates. Ensure all service credentials are connected before continuing.
- Credential Required: Connect your
gmailOAuth2credentials to all Gmail action nodes: Apply Agency Label, Apply Course Label, Apply Collaboration Label, Apply Misc Label, Create Gmail Draft, Auto Reply Course, and Auto Reply Collab. - Credential Required: Connect your
googleSheetsOAuth2Apicredentials to Update Lead Sheet. - In Update Lead Sheet, set Document to
[YOUR_ID]and Sheet Name toSheet1(gid=0).
[YOUR_ID], [YOUR_PHONE], and [YOUR_NAME] in Gmail and Sheets nodes before testing.Step 3: Set Up Sender Extraction and Greeting Logic
This section extracts the sender name and generates the correct intro line for the email response.
- In Extract Sender Name, set Text to
={{ $json.text }}. - Open Sender Name Check and ensure the condition checks
={{ $json.output.sender_name }}with the notEmpty operator. - In Set Named Greeting, set intro_line to
=Dear {{ $json.output.sender_name }}. - In Set Generic Greeting, set intro_line to
=Hey,. - In Merge Intro Line, set Mode to
combine, Join Mode tokeepNonMatches, and Fields To Match to=intro_line.
Step 4: Set Up LLM Classification
Prepare a clean payload for classification and configure the category model for routing.
- In Prepare LLM Payload, map fields: intro_line to
={{ $json.intro_line }}, email_body to={{ $('Gmail Inbox Watcher').item.json.text }}, message_id to={{ $('Gmail Inbox Watcher').item.json.id }}, and thread_id to={{ $('Gmail Inbox Watcher').item.json.threadId }}. - In Classify Email Topic, set Input Text to
={{ $json.email_body }}. - In Classify Email Topic, verify categories:
Agency Lead,Course Request,Paid Collaborations, andMiscellaneouswith their descriptions. - Credential Required: Connect your
openAiApicredentials to OpenAI Classify Engine.
Step 5: Configure Labels, Replies, and Drafts
Route messages based on the classification and apply labels, send replies, and create drafts.
- In Apply Agency Label, set Operation to
addLabels, Message ID to={{ $json.message_id }}, and Label IDs to[YOUR_ID]. - In Apply Course Label, Apply Collaboration Label, and Apply Misc Label, set Operation to
addLabels, Message ID to={{ $json.message_id }}, and Label IDs to[YOUR_ID]. - In Generate Draft Reply, keep JSON Output enabled and confirm the prompt references
{{ $('Merge Intro Line').item.json.intro_line }},{{ $('Gmail Inbox Watcher').item.json.text }}, and{{ $('Gmail Inbox Watcher').item.json.subject }}. Credential Required: Connect youropenAiApicredentials. - In Create Gmail Draft, set Resource to
draft, Message to={{ $json.message.content.body }}, Subject to={{ $json.message.content.subject }}, and Thread ID to={{ $('Apply Agency Label').item.json.threadId }}. - In Auto Reply Course, set Operation to
reply, Email Type totext, Message ID to={{ $json.id }}, and keep the message body with{{ $('Classify Email Topic').item.json.intro_line }}. - In Auto Reply Collab, set Operation to
reply, Email Type totext, Message ID to={{ $json.id }}, and keep the message body with{{ $('Classify Email Topic').item.json.intro_line }}. - In Update Lead Sheet, map columns: Name to
={{ $('Merge Intro Line').item.json.intro_line.replace('Dear ', '') }}, email to={{ $('Gmail Inbox Watcher').item.json.from.value[0].address }}, and subject to={{ $('Gmail Inbox Watcher').item.json.subject }}.
Step 6: Test and Activate Your Workflow
Validate the entire path from email intake to labeling and responses before turning on live automation.
- Click Execute Workflow and send a test email to the connected Gmail inbox.
- Confirm the workflow extracts a sender name, generates intro_line, and classifies the email in Classify Email Topic.
- Verify the correct label node runs (e.g., Apply Agency Label or Apply Course Label), and that a draft or reply is created.
- Check Update Lead Sheet for a new or updated row when a collaboration reply is sent.
- Toggle the workflow to Active to enable continuous processing.
Common Gotchas
- Gmail credentials can expire or need specific permissions. If things break, check the Gmail connection inside n8n credentials first, then confirm the account still has access to the mailbox you’re watching.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About 10 minutes if your labels and sheet are ready.
No. You’ll connect accounts and paste a few IDs into the config fields.
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 API costs, which are usually a few cents per day at low 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 it’s one of the best parts. You can rename the four categories and map them to your own Gmail labels by updating the label IDs in the Set – Config area and adjusting the “Classify Email Topic” logic. Common customizations include adding a “Support” category, splitting “Agency” into “New client” vs. “Existing client,” and changing which categories get auto-replies versus drafts.
Usually it’s expired OAuth permissions or the wrong Gmail account connected. Reconnect Gmail inside n8n credentials, then confirm the trigger is watching the intended mailbox (and that messages are actually arriving as unread). If labels aren’t applying, double-check you pasted the correct label IDs, not just the label names. Also, Gmail can throttle heavy usage, so if you’re processing a big backlog, run smaller batches honestly.
Plenty for a typical small team.
Often, yes, especially once you want branching logic and tighter control over how AI is used. n8n is more flexible when one trigger can go down four different paths (labels, drafts, auto-replies, and Sheets logging), and self-hosting means you’re not paying more just because your inbox got busy. Another advantage is that you can keep the AI prompts and decision logic right next to the Gmail actions, which makes tweaks faster. Zapier or Make can still be a fine choice for very simple labeling, but drafts plus lead logging tends to get messy in “two-step” tools. Talk to an automation expert if you’re not sure which fits.
Once this is running, your inbox stops being a guessing game. The workflow handles the repetitive sorting and prep work so you can focus on the conversations that actually move work forward.
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.