使用 Perplexity AI 研究业务线索并使用 OpenAI 保存到 Google Sheets

高级

这是一个Miscellaneous、AI Summarization、Multimodal AI领域的自动化工作流,包含 18 个节点。主要使用 Set、Merge、SplitOut、Aggregate、Perplexity 等节点。 使用 Perplexity AI 研究业务线索并使用 OpenAI 保存到 Google Sheets

前置要求
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "d6992892-5eae-4c2f-8464-92e9b31a4a94",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        544,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4l6TDfLZVFS24g3X",
          "name": "OpenAi account 4"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cb478ec2-ebb5-41be-b618-bdc2ea5c2673",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        496,
        96
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"Company\": [\"company1\", \"company2\"],\n\t\"Email\": [\"email1\", \"email2\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a182f54b-0b72-4814-838e-90bbb148e56e",
      "name": "Sticky Note59",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        -336
      ],
      "parameters": {
        "color": 7,
        "width": 2416,
        "height": 1056,
        "content": "### 在Google Sheets中研究并记录新业务线索(Perplexity + OpenAI + Google Sheets)"
      },
      "typeVersion": 1
    },
    {
      "id": "b82daab8-e6eb-4835-95a8-29453ee6a758",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1424,
        -336
      ],
      "parameters": {
        "width": 400,
        "height": 1056,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "efedcf0f-7cfe-4cab-9861-b8c8738df238",
      "name": "Sticky Note71",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 688,
        "content": "### 2) 在n8n中设置Perplexity API凭据,请按照以下步骤操作:"
      },
      "typeVersion": 1
    },
    {
      "id": "7a45cba3-0045-4809-a987-767133e667e1",
      "name": "Sticky Note72",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -112
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 656,
        "content": "### 1) 连接Google Sheets(OAuth2)"
      },
      "typeVersion": 1
    },
    {
      "id": "0b0d1e8c-0557-43f5-a15b-5355cfc7749b",
      "name": "Sticky Note69",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        272
      ],
      "parameters": {
        "color": 3,
        "width": 214,
        "height": 400,
        "content": "### 3) 连接 OpenAI (API 密钥)"
      },
      "typeVersion": 1
    },
    {
      "id": "5128ea0a-8d3d-49d1-bba2-102881725941",
      "name": "启动工作流",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -944,
        16
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "936c89eb-8d98-4c03-952e-14754503f71d",
      "name": "设置位置",
      "type": "n8n-nodes-base.set",
      "position": [
        -736,
        16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7fa935ba-7bb5-47f0-8b45-d5bbd054a3a3",
              "name": "Area",
              "type": "string",
              "value": "Hershey PA"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f4fb7a37-a9cd-4c03-9c6e-3a4faf94f50a",
      "name": "获取当前线索",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -480,
        352
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.Area }}",
              "lookupColumn": "Area"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MnaU8hSi8PleDNVcNnyJ5CgmDYJSUTsr7X5HIwa-MLk/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1MnaU8hSi8PleDNVcNnyJ5CgmDYJSUTsr7X5HIwa-MLk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MnaU8hSi8PleDNVcNnyJ5CgmDYJSUTsr7X5HIwa-MLk/edit?usp=drivesdk",
          "cachedResultName": "Perplexity Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "eb5c203e-e317-4e1e-ae13-2c69eaa2bb95",
      "name": "合并为一个",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -224,
        32
      ],
      "parameters": {
        "options": {
          "includeBinaries": true
        },
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "869e140c-1d03-4ecf-a8a1-e999b98643f7",
      "name": "设置为文本",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        -224
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "889ed2f4-ac57-4786-8a7d-da2621f49c50",
              "name": "Search Area",
              "type": "string",
              "value": "={{ $('Set Location').item.json.Area }}"
            },
            {
              "id": "e59a6822-a279-40a7-9894-99e4e1feab37",
              "name": "data",
              "type": "string",
              "value": "={{ $json.data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c52018ce-f30a-4f0a-9a56-bc517b317972",
      "name": "研究线索",
      "type": "n8n-nodes-base.perplexity",
      "position": [
        64,
        560
      ],
      "parameters": {
        "model": "sonar",
        "options": {},
        "messages": {
          "message": [
            {
              "role": "system",
              "content": "Research 20 coffee shops near the area. Output only the company name and the email address for each. Do not include businesses already scraped. "
            },
            {
              "content": "=Area:  {{ $json['Search Area'] }}\nAlready Scraped: {{ $json.data }}"
            }
          ]
        },
        "simplify": true,
        "requestOptions": {}
      },
      "credentials": {
        "perplexityApi": {
          "id": "4GjSxyD0R1XgEnFb",
          "name": "Perplexity account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5a963448-24e1-4519-9448-a388edd9105e",
      "name": "写入 JSON",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        304,
        -128
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "options": {
          "systemMessage": "Convert this to json. \n\nNeed a record for each email address with the name of the company. if null show blank\n\noutput like this. \n\n{\n\t\"Company\": [\"company1\", \"company2\"],\n\t\"Email\": [\"email1\", \"email2\"]\n}\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "c1754baf-e288-4268-9626-24a5741d35f8",
      "name": "拆分公司",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        768,
        -192
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "output.Company"
      },
      "typeVersion": 1
    },
    {
      "id": "c1d17999-2e4a-46e4-8a13-fe0dffc9c646",
      "name": "拆分邮箱列表",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        768,
        48
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "output.Email"
      },
      "typeVersion": 1
    },
    {
      "id": "78ee113d-582e-4ad5-b15b-1504aa1747cb",
      "name": "合并行",
      "type": "n8n-nodes-base.merge",
      "position": [
        960,
        -48
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "1bd2c56a-9c1f-4436-89f7-04bad3acd0c0",
      "name": "发送线索到Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1152,
        176
      ],
      "parameters": {
        "columns": {
          "value": {
            "Area": "={{ $('Set as text').item.json['Search Area'] }}",
            "Email": "={{ $json['output.Email'] }}",
            "Company": "={{ $json['output.Company'] }}"
          },
          "schema": [
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Area",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Area",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MnaU8hSi8PleDNVcNnyJ5CgmDYJSUTsr7X5HIwa-MLk/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1MnaU8hSi8PleDNVcNnyJ5CgmDYJSUTsr7X5HIwa-MLk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MnaU8hSi8PleDNVcNnyJ5CgmDYJSUTsr7X5HIwa-MLk/edit?usp=drivesdk",
          "cachedResultName": "Perplexity Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    }
  ],
  "pinData": {},
  "connections": {
    "Merge Rows": {
      "main": [
        [
          {
            "node": "Send Leads to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write JSON": {
      "main": [
        [
          {
            "node": "Split Companies",
            "type": "main",
            "index": 0
          },
          {
            "node": "Split Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set as text": {
      "main": [
        [
          {
            "node": "Research Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Location": {
      "main": [
        [
          {
            "node": "Get Current Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Emails": {
      "main": [
        [
          {
            "node": "Merge Rows",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Research Leads": {
      "main": [
        [
          {
            "node": "Write JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Set Location",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Companies": {
      "main": [
        [
          {
            "node": "Merge Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Into One": {
      "main": [
        [
          {
            "node": "Set as text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Current Leads": {
      "main": [
        [
          {
            "node": "Combine Into One",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Write JSON",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Write JSON",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个高级难度的工作流,适用于Miscellaneous、AI Summarization、Multimodal AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

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

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

作者
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

外部链接
在 n8n.io 上查看 →

分享此工作流