8
n8n 中文网amn8n.com

使用OCR.space表格识别从收据中提取文本

中级

这是一个Invoice Processing, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 Set, Form, FormTrigger, HttpRequest 等节点。 使用OCR.space表格识别从收据中提取文本

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "51c6a64ef13fda2e6aa96576c25d72519ca4bc44cea9da20af60a642b594d835"
  },
  "nodes": [
    {
      "id": "0663af99-4977-4723-828d-d5e5725d036a",
      "name": "触发器 • 上传图像进行 OCR",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        576,
        288
      ],
      "webhookId": "64016fb2-7c40-4bd4-bf2a-7dacc23d3a7a",
      "parameters": {
        "options": {},
        "formTitle": "Receipt OCR",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "File (Max 1MB)",
              "multipleFiles": false,
              "requiredField": true
            },
            {
              "fieldType": "radio",
              "fieldLabel": "Is it a table",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Yes"
                  },
                  {
                    "option": "No"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "formDescription": "Upload an image to extract text via OCR.\nMax file size: 1 MB"
      },
      "typeVersion": 2.3,
      "alwaysOutputData": false
    },
    {
      "id": "815fc903-a65e-46a5-8177-a0cf8d40aa01",
      "name": "准备 • 标准化输入",
      "type": "n8n-nodes-base.set",
      "position": [
        832,
        288
      ],
      "parameters": {
        "options": {
          "stripBinary": false
        },
        "assignments": {
          "assignments": [
            {
              "id": "c454bde2-a211-448e-ac21-e044044915f6",
              "name": "isTable",
              "type": "string",
              "value": "={{ ($json[\"Is it a table\"] ?? $json.Is_it_a_table) === \"Yes\" }}"
            },
            {
              "id": "07545925-b27a-4471-a5d0-93abc740acf6",
              "name": "File (Max 1MB)",
              "type": "object",
              "value": "={{ $json['File (Max 1MB)'] ?? $json.File__Max_1MB_ }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "baf07380-1179-4077-9c7f-07c92e65bee5",
      "name": "OCR.space • 解析图像",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1088,
        288
      ],
      "parameters": {
        "url": "https://api.ocr.space/parse/image",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "language",
              "value": "pol"
            },
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "File__Max_1MB_"
            },
            {
              "name": "OCREngine",
              "value": "2"
            },
            {
              "name": "isTable",
              "value": "={{ $json.isTable }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "lqCRwWbcuW6VTaIz",
          "name": "ocr.space"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3e1fe87f-e776-469d-bae4-f76de5032ec3",
      "name": "显示 • 显示 OCR 文本",
      "type": "n8n-nodes-base.form",
      "position": [
        1344,
        288
      ],
      "webhookId": "f85368ca-28f1-4c49-bc12-1801c5f8a6b7",
      "parameters": {
        "options": {
          "customCss": ".card {\n\tposition: relative;\n\tmax-width: 500px;\n\tmargin: 20px auto;\n\tpadding: 20px;\n\tbackground: #fefefe !important;\n\tborder-radius: 12px;\n\tbox-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);\n\tfont-family: 'Courier New', monospace;\n\tcolor: #1f2937;\n\tfont-size: 16px;\n\tline-height: 1.6;\n\twhite-space: pre-wrap;\n}\n\n.header p { text-align: left; }\n\n@media (max-width: 768px) {\n\t.card { margin: 10px !important; padding: 15px !important; font-size: 14px; }\n}\n",
          "formTitle": "OCR Result"
        },
        "operation": "completion",
        "completionTitle": "OCR Result",
        "completionMessage": "={{ $json.ParsedResults[0].ParsedText }}"
      },
      "typeVersion": 2.3
    },
    {
      "id": "ba102eff-44a3-48f3-bf37-2c4db27fa1a0",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        96
      ],
      "parameters": {
        "height": 176,
        "content": "### 📌 此流程的作用"
      },
      "typeVersion": 1
    },
    {
      "id": "4c2f78c5-f0f1-40b8-a776-8fd846ec6922",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        96
      ],
      "parameters": {
        "height": 400,
        "content": "### 🔹 触发器 • 上传图像进行 OCR"
      },
      "typeVersion": 1
    },
    {
      "id": "f9d0e10c-466b-4456-9f89-2d50e4a1cf46",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        96
      ],
      "parameters": {
        "width": 256,
        "height": 400,
        "content": "### 🔹 准备 • 标准化输入"
      },
      "typeVersion": 1
    },
    {
      "id": "36621099-7926-463a-a36d-f185cbfb8b82",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        96
      ],
      "parameters": {
        "width": 256,
        "height": 400,
        "content": "### 🔹 OCR.space • 解析图像"
      },
      "typeVersion": 1
    },
    {
      "id": "70f2a795-2c1c-4265-b5d2-af8af703814c",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        96
      ],
      "parameters": {
        "height": 400,
        "content": "### 🔹 显示 • 显示 OCR 文本"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "OCR.space • Parse image": {
      "main": [
        [
          {
            "node": "Display • Show OCR text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare • Normalize inputs": {
      "main": [
        [
          {
            "node": "OCR.space • Parse image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger • Upload image for OCR": {
      "main": [
        [
          {
            "node": "Prepare • Normalize inputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 发票处理, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流