8
n8n 中文网amn8n.com

从JSON数据生成动态折线图并上传至Google Drive

初级

这是一个Other, Building Blocks领域的自动化工作流,包含 5 个节点。主要使用 Set, QuickChart, GoogleDrive, ManualTrigger 等节点。 从JSON数据生成动态折线图并上传至Google Drive

前置要求
  • Google Drive API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "c6511943b220d4ab672ac957465b13db475def5fbbd0b0e41240952f5fd0c300"
  },
  "nodes": [
    {
      "id": "e0721f8a-d157-4ec4-91b3-94060a841dc8",
      "name": "QuickChart",
      "type": "n8n-nodes-base.quickChart",
      "position": [
        240,
        -40
      ],
      "parameters": {
        "data": "={{ $json.jsonData.salesData }}",
        "chartType": "line",
        "labelsMode": "array",
        "labelsArray": "={{ $json.jsonData.labels }}",
        "chartOptions": {},
        "datasetOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b178ca51-357f-4731-8953-75e2370edc2d",
      "name": "编辑字段:设置 JSON 数据进行测试",
      "type": "n8n-nodes-base.set",
      "position": [
        -80,
        -40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1b3ae0ac-7fa5-406c-8e61-d6a9a6c27f07",
              "name": "jsonData",
              "type": "object",
              "value": "={ \"reportTitle\": \"Quarterly Sales\", \"labels\": [\"Q1\", \"Q2\", \"Q3\", \"Q4\"], \"salesData\": [1250, 1800, 1550, 2100] }"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "393665db-f6a6-4294-afd8-3a9f32192c64",
      "name": "Google Drive:上传文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        520,
        -40
      ],
      "parameters": {
        "name": "=chart.{{ $binary.data.fileExtension }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "Vt3z79hk8lh9TUQq",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "c4f2df73-50dc-4b9f-bcb8-43644c0cbed9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        -740
      ],
      "parameters": {
        "width": 1460,
        "height": 1060,
        "content": "## 图表生成器"
      },
      "typeVersion": 1
    },
    {
      "id": "1af3cfc6-f690-4af2-a812-4a4da118a55c",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -400,
        -40
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "QuickChart": {
      "main": [
        [
          {
            "node": "Google Drive: Upload File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Edit Fields: Set JSON data to test",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields: Set JSON data to test": {
      "main": [
        [
          {
            "node": "QuickChart",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

初级 - 其他, 构建模块

需要付费吗?

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

工作流信息
难度等级
初级
节点数量5
分类2
节点类型5
难度说明

适合 n8n 新手,包含 1-5 个节点的简单工作流

作者
Lucas Correia

Lucas Correia

@lucascorrei4

Brazilian Software Engineer passionate about productivity AI tools. Looking to connect with others on building and integrating AI agents into web apps.

外部链接
在 n8n.io 查看

分享此工作流