Skip to main content

Filter and label Gmail emails using keyword-based rules and Google Sheets logging

Workflow preview

Workflow preview
100%
Filter and label Gmail emails using keyword-based rules and Google Sheets logging preview
Open on n8n.io

1. Workflow Overview

This workflow automatically filters and organizes incoming Gmail emails using keyword based classification. The goal is to reduce inbox noise and automatically organize repetitive types of emails s...

Best for

  • Ticket Management automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.set, n8n-nodes-base.code, n8n-nodes-base.gmail, n8n-nodes-base.if, n8n-nodes-base.gmailtrigger, n8n-nodes-base.googlesheets, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Cole Hallgarth.

Original n8n.io source

1.1 Workflow description

Title
Filter and label Gmail emails using keyword-based rules and Google Sheets logging
Workflow name
Filter and label Gmail emails using keyword-based rules and Google Sheets logging

This workflow automatically filters and organizes incoming Gmail emails using keyword-based classification.

The goal is to reduce inbox noise and automatically organize repetitive types of emails so that imprtant messages remain visible while unsolicited or promotional emails are handled automatically.

How it works

  • When a new email arrives in Gmail, the workflow is triggered and retrieves the full email content.
  • It then analyzes the subject line and email snippet for keywords commonly associated with different types of emails.
  • Based on this analysis, the workflow classifies the message into one of several categories and performs actions such as applying Gmail labels, marking the email as read, or removing it from the inbox.

This allows you to automatically separate unsolicited outreach, marketing emails, and legitimate communication without manually reviewing every message.

How to use

  • The workflow will be triggered each time a new email comes in. However, you can change the trigger based on your own needs.
  • The email categories can be changed and adjusted to your own needs as well.
  • Make sure to follow the sticky notes in the workflow to set up your Gmail labels before starting to build the workflow.

Requirement:

  • Gmail connection
  • Optional: Google sheet connection

Customizing this workflow:

Change the email categories based on your real-life needs and if you don't need to google sheet for logging and debugging purposes, feel free to omit them.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Extract Email Data

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.3

Block 2 - Analyze Email Content

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - Label as Outreach

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2

Block 4 - Remove from Inbox

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2

Block 5 - Mark as Read

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2

Block 6 - Check if Marketing

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2

Block 7 - Label as Legitimate

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2

Block 8 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 9 - Get a message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 10 - Check if Needs_review

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2

Block 11 - Label as Needs Review

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2

Block 12 - Check If Cold Outreach

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2

Block 13 - Edit Fields (outreach)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 14 - Edit Fields (needs review)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - Edit Fields (marketing)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 16 - Edit Fields (Legitimate)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 17 - Log to Spreadsheet (outreach)

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4

Block 18 - Log to Spreadsheet (needs review)

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4

Block 19 - Log to Spreadsheet (legitimate)

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4

Block 20 - Log to Spreadsheet (marketing/Ads)

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4

Block 21 - Label as Marketing/Ads

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2

Block 22 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 25 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Filter and label Gmail emails using keyword-based rules and Google Sheets logging
Complexity advanced
Nodes 25
Categories Ticket Management, AI Summarization
Author Cole Hallgarth
Published 05 Mar 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/13903/13903.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Filter and label Gmail emails using keyword-based rules and Google Sheets logging do?

This workflow automatically filters and organizes incoming Gmail emails using keyword based classification. The goal is to reduce inbox noise and automatically organize repetitive types of emails s...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Ticket Management, AI Summarization use case.