8
n8n 中文网amn8n.com

发票解析轻量版

高级

这是一个Finance, AI, IT Ops领域的自动化工作流,包含 29 个节点。主要使用 If, Code, Merge, GoogleDrive, HttpRequest 等节点,结合人工智能技术实现智能自动化。 使用Mistral OCR和Gemini从Google Drive中提取发票数据到Sheets

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "x4DcB7sVAeVmIrMD",
  "meta": {
    "instanceId": "910d3d65eae3484a05204e7f2f6d897587e3de5b30ca7b532a3b4f6f96a2c11c",
    "templateCredsSetupCompleted": true
  },
  "name": "发票解析轻量版",
  "tags": [],
  "nodes": [
    {
      "id": "a8716edb-e05a-43a5-a38f-384fa05e93cf",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        320,
        -80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bce283e2-29fd-47a1-9cfe-c4cf50f4e35d",
      "name": "Google Drive 中的新文件",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        320,
        260
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {
          "fileType": "all"
        },
        "pollTimes": {
          "item": [
            {}
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "15Xpvr0Q4cBwYv1e_jNI8JO4LKAQmgYC2",
          "cachedResultUrl": "https://drive.google.com/drive/folders/15Xpvr0Q4cBwYv1e_jNI8JO4LKAQmgYC2",
          "cachedResultName": "Invoices_Inbox"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "2wyYFvVBTOBlFJRv",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "160e8e02-8f70-4c8f-a3c4-a94cf2325b82",
      "name": "从 Google Drive 文件夹加载文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        880,
        260
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": "15Xpvr0Q4cBwYv1e_jNI8JO4LKAQmgYC2",
            "cachedResultUrl": "https://drive.google.com/drive/folders/15Xpvr0Q4cBwYv1e_jNI8JO4LKAQmgYC2",
            "cachedResultName": "Invoices_Inbox"
          }
        },
        "options": {},
        "resource": "fileFolder",
        "returnAll": true
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "2wyYFvVBTOBlFJRv",
          "name": "Google Drive account"
        }
      },
      "executeOnce": true,
      "typeVersion": 3
    },
    {
      "id": "ad1c63fb-4aae-48a2-8329-20afd04e069d",
      "name": "过滤已处理文件",
      "type": "n8n-nodes-base.merge",
      "position": [
        1360,
        140
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "joinMode": "keepNonMatches",
        "outputDataFrom": "input2",
        "fieldsToMatchString": "id"
      },
      "typeVersion": 3
    },
    {
      "id": "1e689ab2-32d1-453f-b30b-61eb8ac5e1db",
      "name": "下载文件进行 OCR",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1560,
        140
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "2wyYFvVBTOBlFJRv",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "37e21a39-2383-4934-9b41-81b76c484974",
      "name": "从 Sheets 获取已处理行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1160,
        -80
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit?usp=drivesdk",
          "cachedResultName": "n8n_ocr_invoices"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "OZHtTUbddU4IboX9",
          "name": "Google Sheets account"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.3,
      "alwaysOutputData": true
    },
    {
      "id": "140113e8-31da-45f2-901a-cb83bd183478",
      "name": "保存数据到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3640,
        60
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "Id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice No",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Invoice No",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Invoice date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice Period",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Invoice Period",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Gross Amount incl. VAT ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Gross Amount incl. VAT ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "IBAN",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "IBAN",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit?usp=drivesdk",
          "cachedResultName": "n8n_ocr_invoices"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "OZHtTUbddU4IboX9",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "fa83c3b3-b58d-40c8-b94e-93925347b2de",
      "name": "Mistral 上传",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2060,
        120
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "purpose",
              "value": "ocr"
            },
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "1SLwPjP2Z9Gh0p3B",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f0aef4a8-ca9a-48a1-b94e-4879adf679c1",
      "name": "Mistral 签名 URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2260,
        120
      ],
      "parameters": {
        "url": "=https://api.mistral.ai/v1/files/{{ $json.id }}/url",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "expiry",
              "value": "24"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "1SLwPjP2Z9Gh0p3B",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "165556d9-c325-4eb9-b1b2-4983f3fda5a4",
      "name": "Mistral 文档 OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2460,
        100
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/ocr",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"document_url\",\n    \"document_url\": \"{{ $json.url }}\"\n  },\n  \"include_image_base64\": true\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "1SLwPjP2Z9Gh0p3B",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "849bbcd3-122d-4375-b6ae-920e6c5d2b9e",
      "name": "提取模式",
      "type": "n8n-nodes-base.code",
      "position": [
        920,
        -80
      ],
      "parameters": {
        "jsCode": "// Grab the keys from the first row\nconst schema = Object.keys($input.all()[0].json);\n\n// Return a single item whose JSON is just that schema array\nreturn [\n  { json: { schema } }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "ff80d6f4-6758-482c-b5eb-3fa927525948",
      "name": "合并 OCR 页面并移除 id 字段",
      "type": "n8n-nodes-base.code",
      "position": [
        2840,
        100
      ],
      "parameters": {
        "jsCode": "// Node name: Join Pages\n// 1. Grab all incoming documents\nconst docs = $input.all();\n\n// 2. Pull in your schema once and filter it\nlet schema = $('extract schema').first().json.schema;\nconst toRemove = ['Id', 'row_number'];\nschema = schema.filter(f => !toRemove.includes(f));\n\n// 3. Build one output per document\nconst results = docs.map(doc => {\n  // join only that doc’s pages\n  const fullText = doc.json.pages\n    .map(p => p.markdown)\n    .join('\\n\\n');\n\n  return {\n    json: {\n      ocr_text: fullText,\n      schema,\n    },\n  };\n});\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "24f5b810-03cc-49d7-bc64-7748f6be9686",
      "name": "重新添加 Google Drive ID",
      "type": "n8n-nodes-base.code",
      "position": [
        3380,
        60
      ],
      "parameters": {
        "jsCode": "// 1. Get the array of processed files (with id & name)\nconst processed = $('Filter processed files').all();\n\n// 2. Take each LLM output in turn, parse it, inject the matching ID, and return\nreturn $input.all().map((item, index) => {\n  // parse the JSON string your chat node returned\n  const data = JSON.parse(item.json.output);\n\n  // look up the corresponding Drive file ID by array index\n  data.Id   = processed[index]?.json.id ?? null;\n\n\n  // emit for your Sheets node\n  return { json: data };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "407bd6d8-8b90-47bd-84f8-c15f32ea1cf4",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        3060,
        280
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-preview-05-20"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "F7phLhVf9DkmhJc7",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c7ceb651-3f48-49f9-a2f8-f933a63311a8",
      "name": "Mistral 上传1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2080,
        340
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "purpose",
              "value": "ocr"
            },
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "1SLwPjP2Z9Gh0p3B",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "27c0f663-3833-4f67-8f2d-5efcd1a9b8a2",
      "name": "Mistral 签名 URL1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2260,
        340
      ],
      "parameters": {
        "url": "=https://api.mistral.ai/v1/files/{{ $json.id }}/url",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "expiry",
              "value": "24"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "1SLwPjP2Z9Gh0p3B",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "027a9c9c-4ebd-497a-8e61-a3ee63b99666",
      "name": "Mistral 图像 OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2460,
        320
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/ocr",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"image_url\",\n    \"image_url\": \"{{ $json.url }}\"\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "1SLwPjP2Z9Gh0p3B",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "be5e7900-7ae8-4c56-83d5-d0984767abff",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        1780,
        140
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "54e4c552-cdf0-4707-8723-65bcf41d8a96",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{$binary.data.mimeType}}",
              "rightValue": "image/"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f33ce8fa-1412-4889-b586-130119d4bc4b",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        460
      ],
      "parameters": {
        "color": 4,
        "width": 220,
        "height": 80,
        "content": "### 修改文件夹源"
      },
      "typeVersion": 1
    },
    {
      "id": "fdc0a222-8962-4d4a-a50c-abd347794430",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3560,
        260
      ],
      "parameters": {
        "width": 320,
        "height": 100,
        "content": "### 文件 ID"
      },
      "typeVersion": 1
    },
    {
      "id": "f9e36727-f376-4bb3-b32f-bd55eab82e88",
      "name": "字段提取器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        3020,
        60
      ],
      "parameters": {
        "text": "=Extract the following fields from the invoice text:\n\n{{ JSON.stringify($json.schema) }}\n\nImportant: Double-check that all line items are extracted without omission.\n\n- You must respond ONLY with valid raw rendered JSON.\n- Do NOT include the word \"json\".\n- Do NOT include the word \"```json\".\n- Do NOT use triple backticks or markdown formatting.\n- Do NOT wrap the response in any key like \"output\".\n- Do NOT write anything starting at output directly start with valid root-level JSON.\n- Only respond with a valid, root-level JSON object.\n\nText to extract data from: {{ $json.ocr_text }}",
        "options": {
          "systemMessage": "=You are a document parsing assistant designed to extract structured data from invoice PDFs for automated uploading and validation in a financial system."
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "73cc08ed-caa1-405b-8b15-11f2a375fcd9",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        480
      ],
      "parameters": {
        "color": 4,
        "width": 220,
        "height": 80,
        "content": "### 设置检查驱动器文件夹并拉取新文件的间隔"
      },
      "typeVersion": 1
    },
    {
      "id": "d7df816d-3aee-4bd8-9f12-76c23d2108dd",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        -380
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 140,
        "content": "### 选择表格"
      },
      "typeVersion": 1
    },
    {
      "id": "29782ff3-dbdf-4132-90d2-36a9fafa5815",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        -180
      ],
      "parameters": {
        "color": 4,
        "width": 200,
        "height": 80,
        "content": "### 选择表格"
      },
      "typeVersion": 1
    },
    {
      "id": "3d60e92c-2966-4ed3-900a-582cca0f0b8c",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3600,
        -40
      ],
      "parameters": {
        "color": 4,
        "width": 200,
        "height": 80,
        "content": "### 选择保存数据的表格(与开始时相同)"
      },
      "typeVersion": 1
    },
    {
      "id": "3cabcbee-b685-4d9a-9f11-9a3328d70fcd",
      "name": "获取字段模式",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        680,
        -80
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": false,
          "dataLocationOnSheet": {
            "values": {
              "firstDataRow": 1,
              "rangeDefinition": "specifyRange"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WNXkB6SpJyGtPVcHmj1oaaDFikyACCuq6RY5rEPH4OQ/edit?usp=drivesdk",
          "cachedResultName": "n8n_ocr_invoices"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "OZHtTUbddU4IboX9",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "2beee512-688a-4c4a-a4eb-b4a20956ead2",
      "name": "### 需要帮助?",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        -220
      ],
      "parameters": {
        "color": 3,
        "width": 300,
        "height": 120,
        "content": ">> ### 第一列标题在单元格 A1 必须为 \"Id\"。Id 跟踪 Google Drive ID 并确保工作流不会处理先前处理过的文件"
      },
      "typeVersion": 1
    },
    {
      "id": "314e28c9-07c3-45f5-acb2-c2307d935638",
      "name": "## 试试看!",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1540,
        40
      ],
      "parameters": {
        "color": 2,
        "width": 160,
        "height": 80,
        "content": "使用驱动器 ID - 无需修改"
      },
      "typeVersion": 1
    },
    {
      "id": "a3e0322c-3224-40fe-9e82-28274a69d77c",
      "name": "GET 模型",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2040,
        -20
      ],
      "parameters": {
        "color": 2,
        "width": 520,
        "height": 80,
        "content": "需要 Mistral La Platforme 的 API 密钥"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b1ae3903-befa-458f-b6db-ba33ce2d9cac",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Mistral Upload1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Mistral Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Upload": {
      "main": [
        [
          {
            "node": "Mistral Signed URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "extract schema": {
      "main": [
        [
          {
            "node": "Get already processed rows from Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Field Extractor": {
      "main": [
        [
          {
            "node": "Add google drive Id back",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral DOC OCR": {
      "main": [
        [
          {
            "node": "Join OCR Pages and remove id field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Upload1": {
      "main": [
        [
          {
            "node": "Mistral Signed URL1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Fields Schema": {
      "main": [
        [
          {
            "node": "extract schema",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral IMAGE OCR": {
      "main": [
        [
          {
            "node": "Join OCR Pages and remove id field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Signed URL": {
      "main": [
        [
          {
            "node": "Mistral DOC OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Signed URL1": {
      "main": [
        [
          {
            "node": "Mistral IMAGE OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file for OCR": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter processed files": {
      "main": [
        [
          {
            "node": "Download file for OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add google drive Id back": {
      "main": [
        [
          {
            "node": "Save data to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Field Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "On new file in Google Drive": {
      "main": [
        [
          {
            "node": "Load files from Google Drive folder",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Fields Schema",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Load files from Google Drive folder",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Fields Schema",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Join OCR Pages and remove id field": {
      "main": [
        [
          {
            "node": "Field Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load files from Google Drive folder": {
      "main": [
        [
          {
            "node": "Filter processed files",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get already processed rows from Sheets": {
      "main": [
        [
          {
            "node": "Filter processed files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 财务, 人工智能, IT 运维

需要付费吗?

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

工作流信息
难度等级
高级
节点数量29
分类3
节点类型11
难度说明

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

外部链接
在 n8n.io 查看

分享此工作流