8
n8n 中文网amn8n.com

使用Google Sheets自动分析客户评论情绪

中级

这是一个Market Research, AI Summarization领域的自动化工作流,包含 6 个节点。主要使用 Code, GoogleSheets, GoogleSheetsTrigger 等节点。 使用Google Sheets自动分析客户评论情绪

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "46064753-85fe-4f8e-aba1-0e3ba9b994b6",
      "name": "分析情感",
      "type": "n8n-nodes-base.code",
      "position": [
        272,
        48
      ],
      "parameters": {
        "jsCode": "const reviewText = $input.first().json['Review Text'];\nconst reviewId = $input.first().json['Review ID'];\n\nlet sentiment = 'Neutral';\nconst positiveKeywords = ['great', 'excellent', 'amazing', 'happy', 'love', 'satisfied', 'good', 'fantastic', 'awesome', 'recommend'];\nconst negativeKeywords = ['bad', 'poor', 'disappointed', 'problem', 'unhappy', 'frustrating', 'issue', 'terrible', 'worst'];\n\nconst lowerCaseReview = reviewText.toLowerCase();\n\nlet positiveCount = 0;\npositiveKeywords.forEach(keyword => {\n    if (lowerCaseReview.includes(keyword)) {\n        positiveCount++;\n    }\n});\n\nlet negativeCount = 0;\nnegativeKeywords.forEach(keyword => {\n    if (lowerCaseReview.includes(keyword)) {\n        negativeCount++;\n    }\n});\n\nif (positiveCount > negativeCount) {\n    sentiment = 'Positive';\n} else if (negativeCount > positiveCount) {\n    sentiment = 'Negative';\n} else if (positiveCount > 0 && negativeCount > 0) {\n    sentiment = 'Mixed'; // For cases with both positive and negative keywords\n}\n\nreturn [{ json: { sentiment: sentiment, reviewId: reviewId } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "c2830312-8cdc-446a-a0ea-cfecabca7e5e",
      "name": "使用情感更新 Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        496,
        48
      ],
      "parameters": {
        "columns": {
          "value": {
            "Review ID": "={{ $json.reviewId }}",
            "row_number": 0
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Customer Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Customer Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Review Text",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Review Text",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sentiment",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Sentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Review ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Review ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Review ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 789150459,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SOxZwhOEI8XQNu-0wQ3TiWsf01aLEKu48IAgtbEt2CE/edit#gid=789150459",
          "cachedResultName": "customer_reviews_template"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1SOxZwhOEI8XQNu-0wQ3TiWsf01aLEKu48IAgtbEt2CE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SOxZwhOEI8XQNu-0wQ3TiWsf01aLEKu48IAgtbEt2CE/edit?usp=drivesdk",
          "cachedResultName": "Customer Review "
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "vL25dYTf9oT1CSvl",
          "name": "Google Sheets account 2"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "40bedf02-1897-4b02-b2c6-00e24d3352ff",
      "name": "Google Sheets 触发器",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -224,
        48
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 789150459,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SOxZwhOEI8XQNu-0wQ3TiWsf01aLEKu48IAgtbEt2CE/edit#gid=789150459",
          "cachedResultName": "customer_reviews_template"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1SOxZwhOEI8XQNu-0wQ3TiWsf01aLEKu48IAgtbEt2CE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SOxZwhOEI8XQNu-0wQ3TiWsf01aLEKu48IAgtbEt2CE/edit?usp=drivesdk",
          "cachedResultName": "Customer Review "
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "id": "Ummd8YuUEDil2T3f",
          "name": "Google Sheets Trigger account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "41b7911b-7086-45a7-8b8d-dbf75b0351ec",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -176
      ],
      "parameters": {
        "width": 320,
        "height": 400,
        "content": "## 客户评论情感分析器 (Google Sheets)"
      },
      "typeVersion": 1
    },
    {
      "id": "31fc4a2f-03c4-4cff-a766-c4b22d614a59",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        -208
      ],
      "parameters": {
        "height": 512,
        "content": "## Setup Steps\n\nTo get this workflow up and running, follow these instructions:\n\nStep 1: Create Google Sheets Credentials in n8n\n\nIn your n8n instance, click on Credentials in the left sidebar.\n\nClick New Credential.\n\nSearch for and select \"Google Sheets OAuth2 API\" and follow the authentication steps with your Google account. Save it.\n\nMake note of the Credential Name (e.g., \"My Google Sheets Account\").\n\nStep 2: Make a copy  of the Google Sheet [Customer Review](https://docs.google.com/spreadsheets/d/1XmyKfySCUAgyTgnAU3p0bz22D_ofAPoTAUw2HuBezrM/edit?usp=sharing)"
      },
      "typeVersion": 1
    },
    {
      "id": "86cd2976-fe14-4238-a2a6-0400eb3f2cde",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -192
      ],
      "parameters": {
        "height": 464,
        "content": "## Activate and Test the Workflow\n\n\nClick the \"Activate\" toggle button in the top right corner of the n8n workflow editor.\n\nGo to your Google Sheet and manually add a new row with a \"Review Text\" (e.g., \"This product is great, I love it!\"). Leave the \"Sentiment\" column empty.\n\nThe workflow should trigger automatically (it polls every minute by default), analyze the sentiment, and update the \"Sentiment\" column in your Google Sheet. You can also manually \"Execute Workflow\" to test immediately."
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Analyze Sentiment": {
      "main": [
        [
          {
            "node": "Update Google Sheet with Sentiment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "Analyze Sentiment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 市场调研, AI 摘要总结

需要付费吗?

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

工作流信息
难度等级
中级
节点数量6
分类2
节点类型4
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
David Olusola

David Olusola

@dae221

I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - david@daexai.com

外部链接
在 n8n.io 查看

分享此工作流