使用 Gemini Nano Banana 通过 JotForm 和 Google Sheets 生成 AI 产品照片

高级

这是一个自动化工作流,包含 24 个节点。主要使用 If、Set、Merge、Aggregate、GoogleDrive 等节点。 使用 Gemini Nano Banana 通过 JotForm 和 Google Sheets 生成 AI 产品照片

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证

分类

未分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "nodes": [
    {
      "id": "e71df02d-0562-4cce-a478-a7dc7fd1d243",
      "name": "点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -240,
        -80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a75b5a3c-6c0e-4baf-a392-491f33a857e6",
      "name": "获取表格中的行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -32,
        -80
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Pending",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list"
        },
        "documentId": {
          "__rl": true,
          "mode": "list"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "18ce7b03-7ff8-4385-957c-61b7f27accd5",
      "name": "向模型发送消息",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        416,
        -80
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.0-flash-lite",
          "cachedResultName": "models/gemini-2.0-flash-lite"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a professional photographer who do Product protography. Below are the details of a product and what type of photogaric image he need.\n\nWrite down a prompt for an AI model to generate that image:\n\nProduct: {{ $json['Product Name'] }}, {{ $json['Product Description'] }}\n\nProduct image: {{ $json['Product Image'] }}\n\nRequirement: {{ $json.Requirement }}\n\nNote: Just provide the prompt directly, no need to write extra text e.g here is the prompt or something"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ddeb1d41-ba0c-4904-a854-d34dd46c846e",
      "name": "获取图像内容",
      "type": "n8n-nodes-base.set",
      "position": [
        608,
        176
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "021aad70-de11-4387-844e-7e7dfd3b1044",
              "name": "image",
              "type": "string",
              "value": "={{ $json.candidates[0].content.parts.find(part => part.inlineData).inlineData.data }}"
            },
            {
              "id": "62877ef7-2057-4d35-a44b-1d58fa1f1769",
              "name": "mimeType",
              "type": "string",
              "value": "={{ $json.candidates[0].content.parts.find(part => part.inlineData).inlineData.mimeType }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1a7630c1-81de-4116-aaff-6f4dd59d0efc",
      "name": "上传到Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        976,
        176
      ],
      "parameters": {
        "name": "={{ $('Get row(s) in sheet').item.json['Product Name'] }}.{{ $('Get Image Contents').item.json.mimeType.split('/')[1] }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "3c09fc45-ace9-46f0-a360-4a41d06c7bea",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "onError": "continueRegularOutput",
      "position": [
        784,
        176
      ],
      "parameters": {
        "options": {
          "mimeType": "={{ $json.mimeType }}"
        },
        "operation": "toBinary",
        "sourceProperty": "image"
      },
      "typeVersion": 1.1
    },
    {
      "id": "e36ee194-147c-40e6-8a76-ef40f9a77adc",
      "name": "从文件提取",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1344,
        -80
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "50a5cf60-9ab3-4f7d-ac22-4749f0ab9d84",
      "name": "产品",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        -368
      ],
      "parameters": {
        "url": "={{ $('Edit Fields').item.json['Product Image'] }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "5a106c94-7701-4182-afff-1585a0f9bc6b",
      "name": "参考图像1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        -224
      ],
      "parameters": {
        "url": "={{ $('Edit Fields').item.json['Reference Image 1'] }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "67288856-65b9-4c0c-8740-dbda2277b32f",
      "name": "参考图像2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        -80
      ],
      "parameters": {
        "url": "={{ $('Edit Fields').item.json['Reference Image 2'] }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "5687cc9c-f5b5-4fee-b4b2-92e34851947e",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        1152,
        -128
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "a56adec8-21dd-46e6-97ef-638feae54fad",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1520,
        -80
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "7d1905dd-c4c0-417a-ab8d-fff552072586",
      "name": "Gemini Nano Banana",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        416,
        176
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"parts\": [\n        {\n          \"text\": \"{{ $('Message a model').item.json.content.parts[0].text.replaceAll('\n', '').trim() }}\"\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"image/png\",\n            \"data\": \"{{ $json.data[0].data }}\"\n          }\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"image/png\",\n            \"data\": \"{{ $json.data[1].data }}\"\n          }\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"image/png\",\n            \"data\": \"{{ $json.data[2].data }}\"\n          }\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"responseModalities\": [\n      \"TEXT\",\n      \"IMAGE\"\n    ]\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googlePalmApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "e6e97e70-26ae-47a2-a52f-e837cf5a81b9",
      "name": "更新表格中的行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1488,
        384
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Completed",
            "row_number": "={{ $('Edit Fields').item.json.row_number }}",
            "Generated Image": "={{ $json.webViewLink }}"
          },
          "schema": [
            {
              "id": "Product Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Product Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product Description",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Product Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product Image",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Product Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Requirement",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Requirement",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reference Image 1",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Reference Image 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reference Image 2",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Reference Image 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Generated Image",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Generated Image",
              "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": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list"
        },
        "documentId": {
          "__rl": true,
          "mode": "list"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "b7d366da-2337-4e1f-8814-569868db76c3",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -240,
        -240
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cba50728-4600-4fb7-b1b1-5b6f0f336896",
      "name": "JotForm触发器",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        -176,
        352
      ],
      "webhookId": "a148daa2-8925-4acf-93be-5710745fdafb",
      "parameters": {
        "form": "252856264643060"
      },
      "typeVersion": 1
    },
    {
      "id": "dc416865-d5cb-495d-b2fd-200273ff51f9",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        1168,
        176
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "afb4a31f-694b-454c-8a82-7bd38e8d4a49",
              "operator": {
                "type": "object",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $('Get row(s) in sheet') }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d7303fbc-13f6-4efa-a31a-3760b5650965",
      "name": "在表格中添加行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1488,
        192
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Completed",
            "Requirement": "={{ $('Edit Fields').item.json.Requirement }}",
            "Product Name": "={{ $('Edit Fields').item.json['Product Name'] }}",
            "Product Image": "={{ $('Edit Fields').item.json['Product Image'] }}",
            "Generated Image": "={{ $('Upload to Drive').item.json.webViewLink }}",
            "Reference Image 1": "={{ $('Edit Fields').item.json['Reference Image 1'] }}",
            "Reference Image 2": "={{ $('Edit Fields').item.json['Reference Image 2'] }}",
            "Product Description": "={{ $('Edit Fields').item.json['Product Description'] }}"
          },
          "schema": [
            {
              "id": "Product Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Product Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product Description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Product Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product Image",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Product Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Requirement",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Requirement",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reference Image 1",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Reference Image 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reference Image 2",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Reference Image 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Generated Image",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Generated Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list"
        },
        "documentId": {
          "__rl": true,
          "mode": "list"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "1da62ce5-fff7-487e-8df8-3298733fca87",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d8e834ba-f5aa-4ebb-8680-d77aebf8589d",
              "name": "Product Name",
              "type": "string",
              "value": "={{ $json['Product Name'] }}"
            },
            {
              "id": "34f1b39e-873a-4097-8885-9730453d3576",
              "name": "Product Description",
              "type": "string",
              "value": "={{ $json['Product Description'] }}"
            },
            {
              "id": "b35e3428-df98-4022-b442-0d483b267a72",
              "name": "Product Image",
              "type": "string",
              "value": "={{ $json['Product Image'] }}"
            },
            {
              "id": "3e0d71ef-7281-4666-b3a7-61c95dea9e9b",
              "name": "Requirement",
              "type": "string",
              "value": "={{ $json.Requirement }}"
            },
            {
              "id": "ef9f5a64-6deb-4b31-98c3-89ee2fb526b7",
              "name": "Reference Image 1",
              "type": "string",
              "value": "={{ $json['Reference Image 1'] }}"
            },
            {
              "id": "d273e256-f219-4a24-b051-3c9c00abe6db",
              "name": "Reference Image 2",
              "type": "string",
              "value": "={{ $json['Reference Image 2'] }}"
            },
            {
              "id": "e045d017-3ecb-44a4-8dfc-e85723fca91d",
              "name": "row_number",
              "type": "string",
              "value": "={{ $json.row_number }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "83a2bcf2-156a-4dc2-874a-dcd896113c27",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -432
      ],
      "parameters": {
        "width": 768,
        "height": 512,
        "content": "## 图像下载器 - 用于AI"
      },
      "typeVersion": 1
    },
    {
      "id": "2da95b57-343e-47e6-bcd0-ef1bd6dd9833",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        112
      ],
      "parameters": {
        "width": 416,
        "height": 416,
        "content": "## 将所有内容记录到Google表格"
      },
      "typeVersion": 1
    },
    {
      "id": "98ed7751-12d6-4a1e-93cc-8dc96fbaf03f",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        112
      ],
      "parameters": {
        "width": 384,
        "height": 256,
        "content": "## 照片生成"
      },
      "typeVersion": 1
    },
    {
      "id": "a005be5a-d645-4bfa-8929-654358e39fcd",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -304
      ],
      "parameters": {
        "width": 416,
        "height": 384,
        "content": "## 计划执行"
      },
      "typeVersion": 1
    },
    {
      "id": "430cc952-6778-4148-aef7-e57583ae19d5",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        112
      ],
      "parameters": {
        "width": 416,
        "height": 416,
        "content": "## 每当提交jotform时开始执行。在JotForm上注册:https://www"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Add row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Product": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Gemini Nano Banana",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Upload to Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JotForm Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Product",
            "type": "main",
            "index": 0
          },
          {
            "node": "Reference Image 1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Reference Image 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Drive": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reference Image 1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Reference Image 2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Gemini Nano Banana": {
      "main": [
        [
          {
            "node": "Get Image Contents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Image Contents": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个高级难度的通用自动化工作流。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

工作流信息
难度等级
高级
节点数量24
分类-
节点类型14
难度说明

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

作者
Zain Khan

Zain Khan

@zain

I partner with businesses to streamline processes and accelerate growth through intelligent AI automation and Web/mobile Development. Leveraging deep expertise in GPT-4, LangChain, and n8n, I develop AI-powered agents and sophisticated LLM pipelines.

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

分享此工作流