🔓 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

Google Sheets email cleanup, domains extracted fast

Lisa Granqvist Partner Workflow Automation Expert

That “quick cleanup” of an email list never stays quick. You copy, paste, split at @, fix weird formatting, and still end up with broken domains like “gmail” or “company.co” with half the rows shifted.

Email domain extraction is the part that slows down marketing ops teams most, but founders running lean and lead gen freelancers feel it too. The win is simple: clean domains written into Google Sheets so you can segment and route without babysitting formulas.

This n8n workflow extracts the domain from an email address and sets you up to push that result into a Sheet. You will see how it runs, what you need, and where people usually get stuck.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Google Sheets email cleanup, domains extracted fast

The Problem: Email Lists Get Messy Fast

Email lists rarely arrive clean. You get a CSV export with “Name <[email protected]>”, mixed casing, trailing spaces, and the occasional “mailto:” prefix because someone scraped a website. Then you try to segment by company domain for routing (sales territories, partner vs. customer, free vs. paid inboxes), and your spreadsheet turns into a fragile stack of formulas. One small change breaks the whole column. Worse, you don’t notice until an outreach sequence goes to the wrong segment.

The friction compounds. It’s not one big disaster, it’s the little failures that keep showing up.

  • Splitting emails manually in Google Sheets turns into a recurring task that eats about an hour whenever a new list lands.
  • Formula-based extraction breaks on edge cases like “Name <[email protected]>” or rows with extra punctuation.
  • Inconsistent domains ruin segmentation, so your “B2B only” list quietly fills with Gmail and Yahoo addresses.
  • People stop trusting the sheet, which means you end up rechecking everything before sending.

The Solution: Extract Domains Automatically and Keep Sheets Clean

This workflow starts with a simple manual trigger in n8n, then passes an email value into a small function that derives the domain. In plain terms, it takes something like “[email protected]” and returns “acme.com”. That domain can then be written into a dedicated column in Google Sheets, which gives you clean segmentation keys without fragile spreadsheet logic. The workflow is intentionally lightweight, so it’s easy to adapt from “one test email” into “process an entire column of 5,000 rows.” And because the logic lives in n8n, you can reuse it anywhere: list cleanup, lead routing, enrichment calls, or QA checks before outreach.

The workflow kicks off when you run it, uses a provided sample email (or your real input), and derives the domain with a function. From there, the natural next step is sending that domain to Google Sheets, so every row gets a consistent, machine-generated value you can filter and group by.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you get a weekly export of 1,000 new leads and you want domains in a separate column for segmentation. Manually, even at a quick 10 minutes per 100 rows (splitting, checking odd cases, fixing broken cells), that’s about 1.5–2 hours every week. With this workflow, you trigger the run, let n8n extract domains in bulk, and write them back to Google Sheets. The “work” becomes a few minutes of setup and a quick spot-check, not an afternoon lost to spreadsheet babysitting.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Google Sheets to store emails and domains.
  • n8n Function node for the domain extraction logic.
  • Google credentials (set up in n8n “Credentials” for Sheets access).

Skill level: Beginner. You’ll connect Google Sheets and paste in a small bit of workflow logic, then test with a few rows.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

Manual run to stay in control. You start the workflow when you’re ready, which is great for list cleanup jobs that arrive in batches, not as a constant stream.

Input is set up in a simple “Provide Sample Email” step. In the template, that’s a single example value so you can test quickly. In a real setup, this is where you’d pull rows from Google Sheets or pass in data from another workflow.

The function derives the domain. It takes the email string, extracts everything after the “@”, and returns a clean domain field you can use everywhere else in your automation.

Send the output where you need it. Most teams write the domain back into Google Sheets (new column), but you can also route based on domain type, call enrichment APIs, or build suppression rules for personal inbox providers.

You can easily modify the input source to read a full spreadsheet column instead of a sample value based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Manual Trigger

This workflow starts manually so you can test the email domain extraction on demand.

  1. Add the Manual Start Trigger node to your canvas.
  2. Leave the default settings as-is since this trigger has no parameters.
  3. Confirm that Manual Start Trigger connects to Provide Sample Email.

The Flowpast Branding sticky note is informational only and does not affect execution.

Step 2: Connect Provide Sample Email

Provide a sample email address that the workflow will use to extract the domain.

  1. Add the Provide Sample Email node.
  2. Set Keep Only Set to true.
  3. Under Values → String, add a field named email with the value [YOUR_EMAIL].
  4. Ensure Provide Sample Email outputs to Derive Email Domain.

⚠️ Common Pitfall: If you leave [YOUR_EMAIL] unchanged, the function will not return a real domain. Replace it with a valid email address.

Step 3: Set Up Derive Email Domain

This step extracts the domain from the provided email and outputs it as a new JSON field.

  1. Add the Derive Email Domain node.
  2. In Function Code, paste the following code:
    // Take email and extract the domain name var email = ($json["email"]); var name = email.substring(0, email.lastIndexOf("@")); var domain = email.substring(email.lastIndexOf("@") +1); //To display the final domain name. (result) return [{ json: { domain } }]
  3. Verify the node receives input from Provide Sample Email.

Step 4: Configure Output Review

There are no external output destinations, so you will review the result directly in the node output.

  1. Open the Derive Email Domain node after execution to view the output.
  2. Confirm the output JSON includes a domain field with the extracted domain.

Step 5: Test and Activate Your Workflow

Run a manual test to confirm the workflow returns the correct domain.

  1. Click Execute Workflow to run Manual Start Trigger.
  2. Check Derive Email Domain output for a domain value matching the email you set.
  3. When satisfied, toggle the workflow to Active if you plan to expand it with additional triggers or outputs.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Google Sheets credentials can expire or need specific permissions. If things break, check the n8n Credentials entry for Google and re-authenticate first.
  • 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 logic in cleanup workflows is often too optimistic. If your emails include “Name <[email protected]>” formats, adjust the Function step early or you’ll be chasing weird outputs later.

Frequently Asked Questions

How long does it take to set up this email domain extraction automation?

About 20 minutes if your Google Sheets access is already connected.

Do I need coding skills to automate email domain extraction?

No. You’ll mainly connect accounts and edit a small, prebuilt Function step. If you can copy/paste and test a sample row, you’re fine.

Is n8n free to use for this email domain extraction 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 Google usage (usually free for normal Sheets activity).

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 customize this email domain extraction workflow for bulk Google Sheets processing?

Yes, and it’s a common upgrade. Replace the “Provide Sample Email” step with a Google Sheets read step, then loop over rows (Split in Batches) and write the derived domain back to the same row. Many teams also add an If check to skip blanks, plus a merge step to keep the output tidy.

Why is my Google Sheets connection failing in this workflow?

Usually it’s expired OAuth permission or the wrong Google account connected in n8n. Reconnect the Google Sheets credential, then confirm the spreadsheet is shared with that account. If you’re running in a workspace, admin restrictions can block access too, honestly.

How many rows can this email domain extraction automation handle?

A few thousand rows per run is normal.

Is this email domain extraction automation better than using Zapier or Make?

Often, yes, once your “simple cleanup” turns into real logic. n8n makes it easier to handle edge cases (like odd formatting and conditional routing) without stacking paid steps for every little branch. You can also self-host for unlimited executions, which matters when you’re cleaning lists weekly or enriching in bulk. Zapier or Make can still be quicker for a tiny two-step zap, but they get pricey as soon as you add looping and data cleanup. If you’re unsure, Talk to an automation expert and get a straight recommendation.

Once domain extraction runs automatically, your Google Sheets stop being a fragile “do not touch” artifact. Set it up, reuse it, and move on to the work that actually grows revenue.

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