8
n8n 中文网amn8n.com

使用 Freepik、Google Sheets 和 Drive 批量生成 AI 图像

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 11 个节点。主要使用 Code, SplitOut, GoogleDrive, HttpRequest, GoogleSheets 等节点。 使用 Freepik、Google Sheets 和 Drive 批量生成 AI 图像

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "1c13de38-0a50-44a4-b7b1-6d6ff00757d7",
      "name": "启动工作流",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1680,
        736
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "cc6edc5b-5b6e-4de9-9437-6fd38c050ff5",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -160,
        640
      ],
      "parameters": {
        "options": {},
        "operation": "toBinary",
        "sourceProperty": "base64"
      },
      "typeVersion": 1.1
    },
    {
      "id": "b0070e99-0397-4ead-a28e-9457c1fa8770",
      "name": "创建图像",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -672,
        640
      ],
      "parameters": {
        "url": "https://api.freepik.com/v1/ai/text-to-image",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "prompt",
              "value": "={{ $json.Prompt }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "MBOXm1HI3OHfvpZ7",
          "name": "Header Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c5880a1b-d473-4218-a313-465112afb793",
      "name": "分割响应",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -400,
        640
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1
    },
    {
      "id": "fc353193-177e-4f63-8056-b7e3a7c00dc5",
      "name": "上传图片到Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        96,
        688
      ],
      "parameters": {
        "name": "=Image - {{ $('Get Prompt from Google Sheet').item.json.Name }} - {{ $('Double Output').item.json.run }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1TnDibwPPPUm3VbmETiqWDVhtaUTLJ6mn",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1TnDibwPPPUm3VbmETiqWDVhtaUTLJ6mn",
          "cachedResultName": "n8n workflows"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "pl7bkYVKthXr65dR",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "55e34b0d-31ab-4f88-b5b5-b1f8ea9c819f",
      "name": "从Google Sheets获取提示",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1488,
        608
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_u9IxEZINcwKQB15Rfx7C1hM71zeDST58Fz3nRHTCUY/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1_u9IxEZINcwKQB15Rfx7C1hM71zeDST58Fz3nRHTCUY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_u9IxEZINcwKQB15Rfx7C1hM71zeDST58Fz3nRHTCUY/edit?usp=drivesdk",
          "cachedResultName": "freepik prompts"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "46ebdba5-bacd-4726-8837-0ebf6a45c25d",
      "name": "双重输出",
      "type": "n8n-nodes-base.code",
      "position": [
        -1312,
        752
      ],
      "parameters": {
        "jsCode": "const original = items[0].json;\n\nreturn [\n  { json: { ...original, run: 1 } },\n  { json: { ...original, run: 2 } },\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "80e8b545-92ba-493d-a3ce-55a2ee886b6b",
      "name": "循环",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -992,
        656
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "a35010e4-19cc-44f9-b918-7ed8e5504c80",
      "name": "便签 16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1744,
        -128
      ],
      "parameters": {
        "width": 2032,
        "content": "## 📬 需要帮助或想要自定义?"
      },
      "typeVersion": 1
    },
    {
      "id": "422257a0-78a4-4d23-ab5b-3f06859de59c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1744,
        48
      ],
      "parameters": {
        "color": 5,
        "width": 600,
        "height": 860,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a7497ee2-35ea-417d-a36d-70c5680f46ef",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        48
      ],
      "parameters": {
        "color": 6,
        "width": 1400,
        "height": 860,
        "content": "##### 创建图片(HTTP请求)"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Loop": {
      "main": [
        [],
        [
          {
            "node": "Create Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Image": {
      "main": [
        [
          {
            "node": "Split Responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Double Output": {
      "main": [
        [
          {
            "node": "Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Get Prompt from Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Upload Image to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Responses": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Prompt from Google Sheet": {
      "main": [
        [
          {
            "node": "Double Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Image to Google Drive": {
      "main": [
        [
          {
            "node": "Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
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 查看

分享此工作流