8
n8n 中文网amn8n.com

使用RapidAPI总结文本并记录结果到Google Sheets

高级

这是一个Document Extraction, AI Summarization领域的自动化工作流,包含 17 个节点。主要使用 If, Set, Wait, FormTrigger, HttpRequest 等节点。 使用RapidAPI总结文本并将结果记录到Google Sheets

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752"
  },
  "nodes": [
    {
      "id": "e13b8f01-08cd-4b3d-adf6-516e119072a0",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -360,
        -40
      ],
      "webhookId": "ab29cc7f-74d7-41cf-9e85-a269f63237f2",
      "parameters": {
        "options": {},
        "formTitle": "Text Summerizer",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Title",
              "placeholder": "Enter title here",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Content",
              "placeholder": " Lorem ipsum dolor sit amet consectetur...",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Mode",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Paragraph"
                  },
                  {
                    "option": "Bullet"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Length",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Short"
                  },
                  {
                    "option": "Medium"
                  },
                  {
                    "option": "Long"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "responseMode": "lastNode"
      },
      "typeVersion": 2.2
    },
    {
      "id": "a6776021-3f9a-4b85-ae36-c1ead5801c91",
      "name": "映射",
      "type": "n8n-nodes-base.set",
      "position": [
        -140,
        -40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "787925a1-0ab8-4125-9e69-6603affcde26",
              "name": "Mode",
              "type": "string",
              "value": "={{ $json.Mode.toLowerCase() }}"
            },
            {
              "id": "829bcccd-540e-49b8-bf06-275f541ce06e",
              "name": "Length",
              "type": "string",
              "value": "={{ \n            $json.Length === 'Short' ? 1 : \n            $json.Length === 'Medium' ? 2 : \n            $json.Length === 'Long' ? 3 : \n            $json.Length \n          }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "73f4a1b6-ab7c-4c97-a9cc-463fb37601c3",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        140,
        -40
      ],
      "parameters": {
        "url": "https://text-summarizer-ai.p.rapidapi.com/text-summarizer.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "text",
              "value": "={{ $json.Content }}"
            },
            {
              "name": "mode",
              "value": "={{ $json.Mode }}"
            },
            {
              "name": "length",
              "value": "={{ $json.Length }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "text-summarizer-ai.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8ead6257-5eba-4194-ba23-461a8e43b7c1",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        500,
        -260
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1dbef07d-c374-4d83-8410-e7f330b5debe",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.summary }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f46e4239-2fb0-4546-9b93-5708157a2e41",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1140,
        -280
      ],
      "parameters": {
        "columns": {
          "value": {
            "Mode": "={{ $('On form submission').item.json.Mode }}",
            "Title": "={{ $('On form submission').item.json.Title }}",
            "Length": "={{ $('On form submission').item.json.Length }}",
            "Summary": "={{ $json.summary }}",
            "Generated date": "={{ $('On form submission').item.json.submittedAt }}"
          },
          "schema": [
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mode",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Mode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Length",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Length",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Generated date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Generated date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Title"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a560e102-bc4d-418f-80c1-9546b3be37e9",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        740,
        -340
      ],
      "webhookId": "2949f8d2-5f08-45d1-a491-070cb768718f",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "b296c61b-7144-4db0-955d-a945f7dcbdc0",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1560,
        60
      ],
      "parameters": {
        "columns": {
          "value": {
            "Mode": "={{ $('On form submission').item.json.Mode }}",
            "Title": "={{ $('On form submission').item.json.Title }}",
            "Length": "={{ $('On form submission').item.json.Length }}",
            "Summary": "=Error occured. Please Try later",
            "Generated date": "={{ $('On form submission').item.json.submittedAt }}"
          },
          "schema": [
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mode",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Mode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Length",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Length",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Generated date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Generated date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Title"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "8d01bee9-1037-4d16-a1df-6d5fa56bb498",
      "name": "等待1",
      "type": "n8n-nodes-base.wait",
      "position": [
        880,
        60
      ],
      "webhookId": "daf80dbc-1b65-4b25-a00f-10fdc7fc8af1",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "9c0f5f35-ef11-45a8-9d8a-81f724a8a8e1",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1420,
        -540
      ],
      "parameters": {
        "width": 720,
        "height": 1380,
        "content": "# 文本摘要生成器"
      },
      "typeVersion": 1
    },
    {
      "id": "5755da22-4505-4150-a47a-1fa8e6966253",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -280
      ],
      "parameters": {
        "height": 440,
        "content": "### 1. **表单提交时**"
      },
      "typeVersion": 1
    },
    {
      "id": "65a0720f-f654-4c68-abc7-c3404c8ee40d",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        -280
      ],
      "parameters": {
        "height": 440,
        "content": "### 2. **映射**"
      },
      "typeVersion": 1
    },
    {
      "id": "457c1715-76a2-404c-bad8-311432a130f4",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -280
      ],
      "parameters": {
        "height": 440,
        "content": "### 3. **HTTP请求**"
      },
      "typeVersion": 1
    },
    {
      "id": "9d719cdb-5382-42bd-81fe-2e4e8435f5da",
      "name": "便签说明4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -500
      ],
      "parameters": {
        "height": 420,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c083b712-b06a-4aa4-a35d-2266ae0c8d4c",
      "name": "便签说明5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -520
      ],
      "parameters": {
        "height": 300,
        "content": "### 5. **等待**(成功路径)"
      },
      "typeVersion": 1
    },
    {
      "id": "60c471fd-4e59-4318-9e84-4a8b27cbf059",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        -560
      ],
      "parameters": {
        "height": 440,
        "content": "### 6. **Google Sheets**(成功路径)"
      },
      "typeVersion": 1
    },
    {
      "id": "7ca7a3c2-82f9-4404-a554-fef3be31cabe",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        -120
      ],
      "parameters": {
        "height": 340,
        "content": "### 7. **等待1**(错误路径)"
      },
      "typeVersion": 1
    },
    {
      "id": "b7e262ce-ea85-473c-9677-31102bed30cd",
      "name": "## 为什么选择 4o 模型?👆",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1480,
        -180
      ],
      "parameters": {
        "height": 380,
        "content": "### 8. **Google Sheets1**(错误路径)"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mapping": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Mapping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 文档提取, AI 摘要总结

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流