8
n8n 中文网amn8n.com

从 Google Maps 列表抓取企业邮箱到 Google Sheets

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 Code, Wait, Limit, Filter, SplitOut 等节点。 从 Google Maps 列表抓取企业邮箱到 Google Sheets

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "0a25db4fd0692af64b58f35e01611f2ef0b5bb9d6654c57ef3741021e7d8cc11",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "107ba190-7ef3-491f-8318-5f09da35aa4e",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "notes": "Entry point — manually start the workflow via the Test button.",
      "position": [
        -1696,
        -96
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bc847ad4-d899-4c05-9fd2-cd74eb8e9bad",
      "name": "抓取 Google Maps",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Fetches the Google Maps search results page for 'calgary dentists'.",
      "position": [
        -1504,
        -96
      ],
      "parameters": {
        "url": "https://www.google.com/maps/search/calgary+dentists",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          },
          "allowUnauthorizedCerts": true
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "16e8b41b-bf1b-4981-a7da-ab1c5e408d59",
      "name": "提取 URL",
      "type": "n8n-nodes-base.code",
      "notes": "Extracts all URLs from the HTML response and returns one item per URL.",
      "position": [
        -1296,
        -96
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json.data\nconst regex = /https?:\\/\\/[^\\/\\s\"'>]+/g\nconst websites = input?.match?.(regex) || []\nreturn websites.map(website => ({ json: { website } }))"
      },
      "typeVersion": 2
    },
    {
      "id": "b3b3405b-503e-45ee-a2da-bb2f78b4fe78",
      "name": "过滤 Google URL",
      "type": "n8n-nodes-base.filter",
      "notes": "Removes unwanted Google-related or tracking URLs.",
      "position": [
        -1104,
        -96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bf0a5053-9660-457c-9581-964793bb6d7d",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $json.website }}",
              "rightValue": "schema"
            },
            {
              "id": "9110b9e0-12aa-45cc-bde0-9eda8c10970e",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $json.website }}",
              "rightValue": "google"
            },
            {
              "id": "fb9b6ed6-96a5-4560-ab10-b8a4b9a61a2b",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $json.website }}",
              "rightValue": "gg"
            },
            {
              "id": "10500c0b-cdbd-4816-aba3-df60d69845dc",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $json.website }}",
              "rightValue": "gstatic"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b0566b9e-24f6-47ed-896c-8999806e7f21",
      "name": "去除重复项",
      "type": "n8n-nodes-base.removeDuplicates",
      "notes": "Removes duplicate website URLs.",
      "position": [
        -896,
        -96
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "d0180abf-7224-4d0a-a308-c13799b8045d",
      "name": "限制",
      "type": "n8n-nodes-base.limit",
      "notes": "Limits the number of websites processed per run to 10.",
      "position": [
        -720,
        -96
      ],
      "parameters": {
        "maxItems": 10
      },
      "typeVersion": 1
    },
    {
      "id": "acccbda7-518b-4e71-a0b6-16908db9d383",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "notes": "Processes websites one at a time (batch processing).",
      "position": [
        -496,
        -96
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "374b122a-f105-4947-bbcf-4d9bf2d27bf8",
      "name": "等待1",
      "type": "n8n-nodes-base.wait",
      "notes": "Adds a delay between requests to avoid server blocking.",
      "position": [
        -320,
        -160
      ],
      "webhookId": "0fe34756-6e43-4603-8891-5747a9a6500a",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "39dc9452-7cd2-4ce4-87a2-77948e1ab7a2",
      "name": "抓取网站",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Fetches the website HTML (does not follow redirects).",
      "onError": "continueRegularOutput",
      "position": [
        -320,
        0
      ],
      "parameters": {
        "url": "={{ $json.website }}",
        "options": {
          "redirect": {
            "redirect": {
              "followRedirects": false
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3e039367-fd80-4685-9b03-28ccc6c19818",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "notes": "Short wait before parsing to prevent hitting rate limits.",
      "position": [
        -144,
        0
      ],
      "webhookId": "19cc6ed4-4fe7-485b-b879-c679e4b3374d",
      "parameters": {
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "44dafe05-d1f4-4fc6-9538-bb91773d4816",
      "name": "提取邮箱",
      "type": "n8n-nodes-base.code",
      "notes": "Extracts email addresses from the website HTML.",
      "onError": "continueRegularOutput",
      "position": [
        48,
        0
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json.data\nconst regex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.(?!jpeg|jpg|png|gif|webp|svg)[a-zA-Z]{2,}/g\nconst emails = input?.match?.(regex) || []\nreturn { json: { emails } }"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "2426803c-08df-4122-8d29-ebafef75ee80",
      "name": "过滤空值",
      "type": "n8n-nodes-base.filter",
      "notes": "Passes through only items where 'emails' exists and is not empty.",
      "position": [
        -144,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a6786c58-424a-409a-b87f-8a7592cb7944",
              "operator": {
                "type": "array",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.emails }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "86056371-5d34-43ce-8fc3-aa8955cd1ed4",
      "name": "分离",
      "type": "n8n-nodes-base.splitOut",
      "notes": "Splits multiple emails into separate items (one per row).",
      "position": [
        48,
        -160
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "emails"
      },
      "typeVersion": 1
    },
    {
      "id": "b8c18728-bfab-455b-83c1-bae58df8de4e",
      "name": "去除重复项 (2)",
      "type": "n8n-nodes-base.removeDuplicates",
      "notes": "Removes duplicate emails before saving.",
      "position": [
        240,
        -160
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "5030bb27-c027-4b4e-9b32-764490f3958b",
      "name": "添加到表格",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "Appends the extracted emails into the specified Google Sheet.",
      "position": [
        448,
        -160
      ],
      "parameters": {
        "columns": {
          "value": {
            "emails": "={{ $json.emails }}"
          },
          "schema": [
            {
              "id": "emails",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "emails",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "emails"
          ]
        },
        "options": {
          "useAppend": true
        },
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fcijyZM1oU73i2xUbXYJ4j6RshmVEduOkCJji2SJP68/edit#gid=0",
          "cachedResultName": "emails"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1fcijyZM1oU73i2xUbXYJ4j6RshmVEduOkCJji2SJP68",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fcijyZM1oU73i2xUbXYJ4j6RshmVEduOkCJji2SJP68/edit?usp=drivesdk",
          "cachedResultName": "Scrape WITHOUT Paying for APIs"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "cjPjcwa3RdiMAu79",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "bb4be637-eda0-439c-849f-82f9f9fa4ec7",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1488,
        -528
      ],
      "parameters": {
        "color": 4,
        "width": 382,
        "height": 388,
        "content": "## 🗺️ 步骤 1: Google Maps 数据提取"
      },
      "typeVersion": 1
    },
    {
      "id": "52d67670-b212-4627-9c76-6691bd6d47fa",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -896,
        -528
      ],
      "parameters": {
        "color": 5,
        "width": 380,
        "height": 360,
        "content": "此工作流首先通过抓取 Google Maps 来获取商家列表:"
      },
      "typeVersion": 1
    },
    {
      "id": "e66af717-35ce-4c9f-b9a3-19f60578c0db",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        -576
      ],
      "parameters": {
        "color": 6,
        "width": 380,
        "height": 376,
        "content": "**流程:** 使用 HTTP 请求,通过类似 \"Calgary dentists\" 的查询搜索 Google Maps"
      },
      "typeVersion": 1
    },
    {
      "id": "12ec09dc-ba8e-42ce-9956-b8fbe9e3fad0",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -592
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 396,
        "content": "**输出:** 包含商家列表和网站 URL 的原始 HTML"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Extract Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Filter Out Empties",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Remove Duplicates (2)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Site": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract URLs": {
      "main": [
        [
          {
            "node": "Filter Google URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Emails": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Scrape Site",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Google URLs": {
      "main": [
        [
          {
            "node": "Remove Duplicates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Out Empties": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Google Maps": {
      "main": [
        [
          {
            "node": "Extract URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates (2)": {
      "main": [
        [
          {
            "node": "Add to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Scrape Google Maps",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量19
分类2
节点类型11
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Meak

Meak

@meak

I help people build $5k+/month online by starting their own AI agency. Without BS.

外部链接
在 n8n.io 查看

分享此工作流