🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Gmail to Google Sheets, unsubscribes logged and removed

Lisa Granqvist Partner Workflow Automation Expert

You did the hard part: prospecting, personalizing, and sending outreach. Then an “unsubscribe” reply lands… and it gets buried. A week later, the same person gets emailed again because your sheet never got updated.

This Gmail unsubscribe automation hits lead gen specialists hardest, but freelancers and outreach managers feel it too. Not because they don’t care. Because they’re moving fast, juggling lists, and the cleanup work is invisible until it hurts.

This workflow automatically detects unsubscribe intent in Gmail replies, logs the opt-out in Google Sheets, and removes the contact from your main outreach list. You’ll see how it works, what you need, and what to tweak so it matches your campaigns.

How This Automation Works

Here’s the complete workflow you’ll be setting up:

n8n Workflow Template: Gmail to Google Sheets, unsubscribes logged and removed

Why This Matters: Unsubscribes Get Missed (and You Pay for It)

Unsubscribe requests don’t show up as a neat checkbox in your CRM when you’re running list-based outreach. They arrive as messy human replies: “remove me,” “stop emailing,” “not interested,” sometimes with a signature block longer than the message. If you’re managing multiple campaigns or client inboxes, it’s easy to miss one, or forget to update the right sheet. Then you re-email someone who opted out. That can trigger spam complaints, damage deliverability, and create awkward client conversations you honestly don’t need.

It adds up fast. Here’s where it breaks down in real teams.

  • Someone replies “unsubscribe,” but the email is read on mobile and never gets logged anywhere.
  • You remove them from one list, but they’re still sitting in a second “master” Google Sheet used for follow-ups.
  • A VA or teammate updates the sheet later and accidentally deletes the wrong row because multiple contacts share a similar name.
  • You keep sending follow-ups because your sending tool only knows what the spreadsheet tells it.

What You’ll Build: Unsubscribe Detection That Updates Sheets Automatically

This workflow watches your Gmail inbox for new replies, then uses OpenAI to interpret the message and decide if it’s an unsubscribe request. If the reply looks like an opt-out, the workflow standardizes that decision (“unsubscribe” vs “keep”) so you don’t rely on fuzzy wording. Next, it checks your Google Sheets opt-out list to avoid duplicates. If the email isn’t already listed, it writes a clean record to an “Unsubscribe Sheet,” removes the matching row from your “Main Outreach Sheet,” and (optionally) applies an “Unsubscribe” label back in Gmail so you can spot these threads instantly. It’s list hygiene that runs in the background, not a new tool your team has to remember.

The workflow starts on a Gmail reply trigger. OpenAI handles intent detection, then a Code step verifies and normalizes the output. Finally, Google Sheets becomes the single source of truth: one sheet to exclude, one sheet to keep clean.

What You’re Building

Expected Results

Say you run outreach for one inbox and you get about 10 replies a day. Manually, reading each reply, deciding if it’s an opt-out, searching the email in Google Sheets, removing the row, and logging it elsewhere can take maybe 3 minutes each, so you’re spending roughly 30 minutes daily. With this workflow: Gmail triggers it, the AI classifies the intent, and Sheets updates automatically in the background. You still skim replies for sales opportunities, but unsubscribe cleanup drops to near zero.

Before You Start

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Gmail for reading replies and applying labels.
  • Google Sheets to store your main list and opt-outs.
  • OpenAI API key (get it from your OpenAI dashboard under API keys)

Skill level: Intermediate. You’ll connect credentials, map sheet columns, and run a few real-world tests before turning it on.

Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).

Step by Step

A new reply hits your Gmail inbox. The workflow’s Gmail trigger checks for replies on a regular polling schedule (the template uses about every 5 minutes by default).

Personal emails are filtered out early. A quick “personal address” check can stop internal/team emails from being processed, which keeps your opt-out logic focused on outreach replies.

AI classifies the intent, then your logic confirms it. OpenAI reviews the message text for opt-out language, and a Code step standardizes the result to a clean “unsubscribe” or “keep” value so downstream steps don’t get confused.

Google Sheets is updated and Gmail is labeled. If it’s an unsubscribe, the workflow checks your opt-out sheet to avoid duplicates, appends a record when needed, removes the contact from your main outreach sheet, and applies an “Unsubscribe” Gmail label (optional).

You can easily modify the polling frequency to match your sending volume, or swap the sheet structure to fit your existing columns. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Gmail Trigger

Set up the trigger that watches for incoming email replies and starts the unsubscribe flow.

  1. Add and open Email Reply Watcher.
  2. Set Include Spam & Trash to true (already enabled in filters).
  3. Set Poll Times to every 5 minutes.
  4. Credential Required: Connect your Gmail credentials.

If your replies are missing, confirm the Gmail account you authenticate matches the sender mailbox you monitor.

Step 2: Connect Google Sheets

Configure the sheets that store your opt-out list and main contact records.

  1. Open Lookup Main Sheet and set Document ID and Sheet Name to your source spreadsheet IDs (currently [YOUR_ID]).
  2. In Lookup Main Sheet, set the filter to EMAIL with lookup value {{ $('Email Reply Watcher').item.json.From.match(/<([^>]+)>/)?.[1]?.trim().toLowerCase() || $('Email Reply Watcher').item.json.From.trim().toLowerCase() }}.
  3. Credential Required: Connect your googleSheetsOAuth2Api credentials in Lookup Main Sheet.
  4. Open Retrieve Opt-out Sheet, Append Opt-out Record, and Remove Sheet Row and replace Document ID and Sheet Name values (currently [YOUR_ID]).
  5. Credential Required: Connect Google Sheets credentials for Retrieve Opt-out Sheet, Append Opt-out Record, and Remove Sheet Row (they are set to serviceAccount authentication but credentials are not configured).

⚠️ Common Pitfall: The sheet column names in Append Opt-out Record must exactly match EMAIL, DATE, WHERE, and MESSAGE for inserts to succeed.

Step 3: Set Up AI Intent Detection

Use the AI chain to classify whether the reply is an unsubscribe request.

  1. Open OpenAI Chat Engine and set Model to gpt-4o-mini, Max Tokens to 20, and Temperature to 0.1.
  2. Credential Required: Connect your OpenAI credentials in OpenAI Chat Engine.
  3. Open Intent Detection Chain and set Prompt to =You are a message intent detector for outreach emails. Your job is to determine if this message means the sender wants to stop receiving emails or unsubscribe. Reply strictly with one word: - "unsubscribe" → if they indicate they don't want further contact (even indirectly) - "keep" → if they are interested, neutral, or unrelated. Message: {{ $json.snippet }}.
  4. Verify OpenAI Chat Engine is connected as the language model for Intent Detection Chain; credentials are added to OpenAI Chat Engine, not the chain.
  5. Open Standardize AI Result and keep the JavaScript as-is to normalize the AI response and set isUnsubscribe.

If you customize the prompt, ensure the AI still returns only unsubscribe or keep to avoid breaking Unsubscribe Decision.

Step 4: Configure the Unsubscribe Decision Path

Filter personal addresses, detect unsubscribe intent, and prevent duplicate entries.

  1. Open Personal Address Filter and set the condition to check if From contains [YOUR_EMAIL] using left value {{ $json.From }}. Replace [YOUR_EMAIL] with your actual sender address or domain.
  2. Open Unsubscribe Decision and ensure the condition compares {{ $json.text }} to unsubscribe.
  3. Open Retrieve Opt-out Sheet and confirm it reads from the same opt-out sheet you append to.
  4. In Check Email Presence, keep the JavaScript to skip emails already in the opt-out sheet and output { Email: currentEmail } when not present.
  5. Open Existing Entry Gate and confirm the condition checks {{ $json.Email }} equals {{ $('Retrieve Opt-out Sheet').item.json.EMAIL }}.

⚠️ Common Pitfall: If your opt-out sheet uses a different column name (e.g., Email instead of EMAIL), update both Retrieve Opt-out Sheet and Existing Entry Gate references.

Step 5: Configure the Output Actions

Append the opt-out record, remove the contact from the main sheet, and label the original Gmail thread.

  1. Open Append Opt-out Record and map the columns as follows: DATE to {{ new Date().toISOString().split('T')[0] }}, EMAIL to {{ $('Check Email Presence').first().json.Email }}, WHERE to UNSUBSCRIBE MESSAGE REPLY, and MESSAGE to {{ $('Email Reply Watcher').item.json.snippet }}.
  2. Open Remove Sheet Row and keep Operation set to delete and Start Index set to {{ $json.row_number }}.
  3. Open Apply Gmail Opt-out Label and set Message ID to {{ $('Email Reply Watcher').item.json.id }} with Operation addLabels and label ID set to your opt-out label (replace [YOUR_ID]).
  4. Credential Required: Connect your Gmail credentials in Apply Gmail Opt-out Label.

End Placeholder A and End Placeholder B are no-op nodes that mark flow endings; keep them for clarity or future expansion.

Step 6: Test and Activate Your Workflow

Validate the end-to-end flow, then enable it for production.

  1. Click Execute Workflow and send a test reply email that includes an unsubscribe intent (e.g., “please unsubscribe”).
  2. Verify the path runs in this order: Email Reply WatcherPersonal Address FilterIntent Detection ChainStandardize AI ResultUnsubscribe DecisionRetrieve Opt-out SheetCheck Email PresenceExisting Entry GateAppend Opt-out RecordLookup Main SheetRemove Sheet RowApply Gmail Opt-out Label.
  3. Confirm a new opt-out row is appended, the contact row is removed from your main sheet, and the Gmail label is applied.
  4. Turn the workflow Active to enable continuous polling and processing.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Troubleshooting Tips

  • Gmail credentials can expire or need specific permissions. If things break, check the n8n Credentials Manager and confirm the Gmail scope still allows reading replies and applying labels.
  • 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.

Quick Answers

What’s the setup time for this Gmail unsubscribe automation?

About 30 minutes if your Gmail, Sheets, and OpenAI accounts are ready.

Is coding required for this unsubscribe automation?

No. You’ll mostly connect credentials and match your Google Sheets columns. The included Code step is prebuilt and only needs edits if you want custom rules.

Is n8n free to use for this Gmail unsubscribe automation workflow?

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 for low reply volume.

Where can I host n8n to run this automation?

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.

Can I modify this Gmail unsubscribe automation workflow for different use cases?

Yes, and you probably should. You can adjust the “Email Reply Watcher” polling interval, swap your sheet IDs in the Google Sheets steps, and customize the “Standardize AI Result” logic so it recognizes extra phrases your audience uses. Many teams also disable “Apply Gmail Opt-out Label” if they prefer to keep inbox labeling manual.

Why is my Gmail connection failing in this workflow?

Most of the time it’s expired OAuth access or the wrong Gmail account connected in n8n. Reconnect Gmail in the Credentials Manager, then re-run a test execution using a real reply email. Also confirm the workflow has permission to apply labels if you kept the Gmail labeling step enabled.

What volume can this Gmail unsubscribe automation workflow process?

For most small teams, hundreds of replies per day is fine.

Is this Gmail unsubscribe automation better than using Zapier or Make?

Often, yes, because this workflow benefits from multi-step logic: filter personal replies, run AI intent detection, standardize results, check for duplicates, then update two sheets and Gmail. n8n handles branching cleanly, and self-hosting can be a big deal if you’re processing lots of inbox traffic without wanting per-task fees. Zapier or Make can still work, but AI classification plus deduping plus sheet row deletion usually turns into a fragile chain. If you just need “label email when it contains the word unsubscribe,” those tools are fine. If you want list hygiene you can trust, n8n is a safer bet. Talk to an automation expert if you want help choosing.

Once this is running, opt-outs stop being a stressful “did we remember?” task. Your sheets stay clean, your inbox stays readable, and your outreach stays safer for the long haul.

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.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal