AutomationFlowsEmail & Gmail › Auto Label Success Cases V2

Auto Label Success Cases V2

Auto Label Success Cases v2. Uses googleSheets, gmail. Event-driven trigger; 8 nodes.

Event trigger★★★★☆ complexity8 nodesGoogle SheetsGmail
Email & Gmail Trigger: Event Nodes: 8 Complexity: ★★★★☆ Added:

This workflow follows the Gmail → Google Sheets recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Auto Label Success Cases v2",
  "nodes": [
    {
      "parameters": {},
      "id": "manual-trigger",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "value": "13iOvpUd6OjZPgMeFKL42RlPk326JCLNzT8tyEM-SY8I",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "OK",
          "mode": "name"
        },
        "options": {}
      },
      "id": "read-ok-sheet",
      "name": "Read OK Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        240,
        160
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "value": "13iOvpUd6OjZPgMeFKL42RlPk326JCLNzT8tyEM-SY8I",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "CHECK",
          "mode": "name"
        },
        "options": {}
      },
      "id": "read-check-sheet",
      "name": "Read CHECK Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        240,
        320
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "value": "13iOvpUd6OjZPgMeFKL42RlPk326JCLNzT8tyEM-SY8I",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Enquiries",
          "mode": "name"
        },
        "options": {}
      },
      "id": "read-enquiries-sheet",
      "name": "Read Enquiries Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        240,
        480
      ]
    },
    {
      "parameters": {
        "jsCode": "// Combine all inputs and extract unique emails\nconst allItems = $input.all();\nconst emails = new Set();\n\nfor (const item of allItems) {\n  const data = item.json;\n  // Try various email field names\n  const possibleFields = ['Email', 'email', 'Email Address', '\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9', 'User Email', 'Contact Email'];\n  \n  for (const field of possibleFields) {\n    if (data[field] && typeof data[field] === 'string' && data[field].includes('@')) {\n      emails.add(data[field].toLowerCase().trim());\n      break;\n    }\n  }\n  \n  // Also check all fields for email pattern\n  for (const [key, value] of Object.entries(data)) {\n    if (typeof value === 'string' && value.includes('@') && value.includes('.')) {\n      const emailMatch = value.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/);\n      if (emailMatch) {\n        emails.add(emailMatch[0].toLowerCase().trim());\n      }\n    }\n  }\n}\n\nconsole.log(`Found ${emails.size} unique emails`);\n\n// Return as array\nreturn Array.from(emails).map(email => ({ json: { email } }));"
      },
      "id": "extract-emails",
      "name": "Extract Unique Emails",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        320
      ]
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "getAll",
        "returnAll": false,
        "limit": 50,
        "filters": {
          "q": "=from:{{ $json.email }} OR to:{{ $json.email }}"
        },
        "options": {}
      },
      "id": "search-gmail",
      "name": "Search Gmail",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        760,
        320
      ]
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "addLabels",
        "messageId": "={{ $json.id }}",
        "labelIds": [
          "REPLACE_WITH_LABEL_ID"
        ]
      },
      "id": "add-label",
      "name": "Add Label",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1000,
        320
      ]
    },
    {
      "parameters": {
        "content": "## \u8a2d\u5b9a\u624b\u9806\n\n1. **Google Sheets\u8a8d\u8a3c**\n   \u5404Read Sheet\u30ce\u30fc\u30c9\u306b\u8a8d\u8a3c\u8a2d\u5b9a\n\n2. **Gmail\u8a8d\u8a3c**\n   Search Gmail, Add Label \u30ce\u30fc\u30c9\u306b\u8a8d\u8a3c\u8a2d\u5b9a\n\n3. **Label ID\u8a2d\u5b9a**\n   Add Label \u30ce\u30fc\u30c9 \u2192 Label IDs \u2192 \u300csuccess cases\u300d\u9078\u629e\n\n4. **\u5b9f\u884c**\n   \u300cTest workflow\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af",
        "height": 280,
        "width": 300
      },
      "id": "sticky-note",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Read OK Sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Read CHECK Sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Read Enquiries Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read OK Sheet": {
      "main": [
        [
          {
            "node": "Extract Unique Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read CHECK Sheet": {
      "main": [
        [
          {
            "node": "Extract Unique Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Enquiries Sheet": {
      "main": [
        [
          {
            "node": "Extract Unique Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Unique Emails": {
      "main": [
        [
          {
            "node": "Search Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Gmail": {
      "main": [
        [
          {
            "node": "Add Label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Auto Label Success Cases v2. Uses googleSheets, gmail. Event-driven trigger; 8 nodes.

Source: https://gist.github.com/athearthapp/6366619f81741ab1b1666ef4eb9ba3c5 — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

Stop losing valuable leads to missed meetings with this No-Show Follow-Up & Rescheduling automation! Whenever a lead is marked as a “no-show” in your CRM or calendar, this workflow automatically sends

Google Calendar, Gmail, Google Sheets
Email & Gmail

This workflow automatically detects bounced or invalid email addresses from your Gmail inbox and updates their status in Google Sheets. It fetches bounce notifications, extracts failed email addresses

Google Sheets, Slack, Gmail
Email & Gmail

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. When

Gmail, Gmail Trigger, Google Sheets
Email & Gmail

This workflow streamlines accounts receivable management by automatically monitoring invoices in Google Sheets and sending scheduled payment reminders. It is designed for businesses using Gmail and Go

Form Trigger, Gmail, Google Sheets +1
Email & Gmail

Never miss a qualified LinkedIn Sales Navigator message again. This automation monitors your Gmail for LinkedIn notifications, cross-references senders with your lead database in Google Sheets, and in

Gmail, Google Sheets