财务 OCR V1.3
高级
这是一个Invoice Processing, AI Summarization领域的自动化工作流,包含 18 个节点。主要使用 Set, Airtable, GoogleDrive, SplitInBatches, Agent 等节点。 使用 Nanonets OCR 和 Command-R 从 Google Drive 到 Airtable 的发票数据提取自动化
前置要求
- •Airtable API Key
- •Google Drive API 凭证
- •OpenAI API Key
使用的节点 (18)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "kGkBDcAuzlqqWeWP",
"meta": {
"instanceId": "e21631593c665e575c87e460dd8681c44b1aaa7afc3347cf8214a1b5119341f4",
"templateCredsSetupCompleted": true
},
"name": "fin_ocr_V1.3",
"tags": [],
"nodes": [
{
"id": "520e70c0-0a88-4837-95bd-dfc7a62f6b57",
"name": "下载文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
288,
144
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {
"binaryPropertyName": "data"
},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "3EQaD4AKrYvv4hHb",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "71c96b1b-91fb-4b15-b9e6-eafe713d34f5",
"name": "移动失败",
"type": "n8n-nodes-base.googleDrive",
"position": [
1696,
208
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('file name & ID').first().json.fileId }}"
},
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1lhpEYJrR0ZpQ6yjsf_fa6Ob5X7Ms28ED",
"cachedResultUrl": "https://drive.google.com/drive/folders/1lhpEYJrR0ZpQ6yjsf_fa6Ob5X7Ms28ED",
"cachedResultName": "fin_ocr_failed"
},
"operation": "move"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "3EQaD4AKrYvv4hHb",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "7f2ee535-6f0c-433a-a08d-daf53dc58ee9",
"name": "移动成功",
"type": "n8n-nodes-base.googleDrive",
"position": [
1872,
304
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('file name & ID').first().json.fileId }}"
},
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1nZDoVJjKTITGSmb8BMu09TtHX8QGUkhr",
"cachedResultUrl": "https://drive.google.com/drive/folders/1nZDoVJjKTITGSmb8BMu09TtHX8QGUkhr",
"cachedResultName": "fin_ocr_done"
},
"operation": "move"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "3EQaD4AKrYvv4hHb",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "1623bb25-f453-4e64-8ba9-3d8357c1a905",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-160,
272
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "8a20d5de-c6d6-40e1-be01-5e00c7340010",
"name": "文件名和 ID",
"type": "n8n-nodes-base.set",
"position": [
64,
144
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "2c6afd48-9425-4c53-aecc-02ddad6a80e0",
"name": "fileId",
"type": "string",
"value": "={{ $json.id }}"
},
{
"id": "0294a252-d8ea-4796-9a37-f88d27ac78f9",
"name": "orfilename",
"type": "string",
"value": "={{ $json.originalFilename }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "b96ff546-abe2-4bf7-b8fd-67f29170a647",
"name": "完成!",
"type": "n8n-nodes-base.noOp",
"position": [
64,
-48
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a5b9cc98-fb3e-4faf-84e9-37cdd5b3fd91",
"name": "AI Agent-OCR",
"type": "@n8n/n8n-nodes-langchain.agent",
"onError": "continueErrorOutput",
"position": [
512,
144
],
"parameters": {
"text": "=Extract the full text as output from the document as if you were reading it. Return the tables in html format. Return the equations in LaTeX representation.",
"options": {
"systemMessage": "You are a helpful assistant."
},
"promptType": "define",
"needsFallback": true
},
"retryOnFail": true,
"typeVersion": 2.2
},
{
"id": "d27bfe6f-619d-49f6-a965-60dcac00c3d9",
"name": "数据清理器",
"type": "@n8n/n8n-nodes-langchain.openAi",
"onError": "continueErrorOutput",
"position": [
864,
80
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "id",
"value": "command-r7b:7b-12-2024-q8_0"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are an expert financial data entry agent.\n\nYour input data will be a JSON object or text containing Optical character recognition (OCR) of an invoice data. It may contain missing fields, extra fields, or inconsistent formatting.\n\nYour task is to:\n1. Extract data from the input into a strictly valid JSON object using the following schema:\n{\n \"InvoiceNumber\": \"\",\n \"IssueDate\": \"\",\n \"SupplierName\": \"\",\n \"TotalAmount\": \"\",\n \"Currency\": \"\",\n \"Address\": \"\",\n \"LineItems\": [\n {\n \"Description\": \"\",\n \"Quantity\": \"\",\n \"UnitPrice\": \"\",\n \"VATRate\": \"\",\n \"VATAmount\": \"\",\n \"LineTotal\": \"\"\n }\n ]\n}\n2. Remove any fields not included above.\n3. If a value is missing or ambiguous, set it to null.\n4. Format \"LineItems\" as a list of dictionaries with the specified keys, and ensure all line item fields are present.\n5. Output only the sanitized, strictly valid Airtable-ready JSON object. Do not include any explanation or extra text.\n\nabout the Number fields (\"TotalAmount\", and all numeric fields in \"LineItems\"):\n1. All number fields must be formatted as valid JSON numbers (e.g., 17000, 1210.50) or be set to null.\n2. You MUST remove all currency symbols (e.g., \"$\", \"€\").\n3. You MUST remove all thousands separators (e.g., \",\").\n4. Ensure any decimal separator is a period \".\" (e.g., convert \"12,50\" to 12.50).\n5. For example: convert \"€17,000\" to 17000. Convert \"1.210,50\" to 1210.50.\n\nCritical: the fields MUST be filled JUST from the input data.\nInput:\n{{ $json.output }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "RvORsIVRZ98wrTDU",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "39ed5668-cf2b-4f76-8cb6-0f3ea0231059",
"name": "OCR 文件夹",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-464,
272
],
"parameters": {
"event": "fileCreated",
"options": {
"fileType": "all"
},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1Zld3XYxC1kYYm_rMla3tuqeZsAaol9DS",
"cachedResultUrl": "https://drive.google.com/drive/folders/1Zld3XYxC1kYYm_rMla3tuqeZsAaol9DS",
"cachedResultName": "fin_ocr"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "3EQaD4AKrYvv4hHb",
"name": "Google Drive account"
}
},
"typeVersion": 1
},
{
"id": "b803e5e5-68e1-45b7-9474-3eb5bb7d0626",
"name": "AirTable - 创建记录1",
"type": "n8n-nodes-base.airtable",
"position": [
1312,
304
],
"parameters": {
"base": {
"__rl": true,
"mode": "list",
"value": "apptHu8glutmVeMb5",
"cachedResultUrl": "https://airtable.com/apptHu8glutmVeMb5",
"cachedResultName": "ocr_base"
},
"table": {
"__rl": true,
"mode": "list",
"value": "tbln2iu3xlqtI0WUH",
"cachedResultUrl": "https://airtable.com/apptHu8glutmVeMb5/tbln2iu3xlqtI0WUH",
"cachedResultName": "Invoices"
},
"columns": {
"value": {
"FileID": "={{ $('file name & ID').item.json.id }}",
"Address": "={{ $json.message.content.Address }}",
"Currency": "={{ $json.message.content.Currency }}",
"FileName": "={{ $('file name & ID').item.json.name }}",
"IssueDate": "={{ DateTime.fromFormat($json.message.content.IssueDate, 'dd/MM/yy').toISODate() }}",
"LineItems": "={{ $json.message.content.LineItems }}",
"TotalAmount": "={{ $json.message.content.TotalAmount }}",
"SupplierName": "={{ $json.message.content.SupplierName }}",
"InvoiceNumber": "={{ $json.message.content.InvoiceNumber }}"
},
"schema": [
{
"id": "itemID",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "itemID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "InvoiceNumber",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "InvoiceNumber",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "IssueDate",
"type": "dateTime",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "IssueDate",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "SupplierName",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "SupplierName",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TotalAmount",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "TotalAmount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Currency",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "Currency",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Address",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "Address",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "LineItems",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "LineItems",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "FileName",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "FileName",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "FileID",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "FileID",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {
"typecast": true
},
"operation": "create"
},
"credentials": {
"airtableTokenApi": {
"id": "YrTFaDnz1wrlC7rU",
"name": "Airtable Personal Access Token account"
}
},
"typeVersion": 2.1
},
{
"id": "0443a7f6-67da-4536-b980-082b48432d05",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1216,
-112
],
"parameters": {
"color": 6,
"width": 560,
"height": 640,
"content": "## 🚀 欢迎使用:OCR 到 Airtable 流水线"
},
"typeVersion": 1
},
{
"id": "9972fd7b-b812-4e10-a044-1c6d88ca3f92",
"name": "便签 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-592,
-16
],
"parameters": {
"width": 352,
"height": 448,
"content": "## 1. 配置 \"新文件\" 触发器"
},
"typeVersion": 1
},
{
"id": "f781ba6c-36cb-4158-9fa3-195e7d18d28a",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
544,
512
],
"parameters": {
"model": {
"__rl": true,
"mode": "id",
"value": "=benhaotang/Nanonets-OCR-s:F16"
},
"options": {
"responseFormat": "text"
}
},
"credentials": {
"openAiApi": {
"id": "RvORsIVRZ98wrTDU",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "484cc002-53bb-42ea-a54d-f6c75d6e06e7",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
336,
464
],
"parameters": {
"color": 5,
"width": 496,
"height": 480,
"content": ""
},
"typeVersion": 1
},
{
"id": "eccbea42-cfd1-4a0b-9cc8-437813e4992b",
"name": "便签 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
784,
-256
],
"parameters": {
"color": 2,
"width": 416,
"height": 448,
"content": "## 3. 配置数据清理 AI"
},
"typeVersion": 1
},
{
"id": "8db3ef29-185f-4ff6-a1bf-3b123eef61c6",
"name": "便签 4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1104,
288
],
"parameters": {
"color": 6,
"width": 496,
"height": 560,
"content": ""
},
"typeVersion": 1
},
{
"id": "27a3770b-391f-4688-89bd-19aca6b307ec",
"name": "便签 5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1632,
-48
],
"parameters": {
"color": 7,
"width": 496,
"height": 496,
"content": "## 5. 配置 \"完成\" 和 \"失败\" 文件夹"
},
"typeVersion": 1
},
{
"id": "ddfbafad-d739-4e26-b0f3-27ef4ccbeebd",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
-240
],
"parameters": {
"color": 4,
"width": 464,
"height": 320,
"content": "## 6.✅ 全部完成!"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "7c309cda-f010-4b55-b1f2-7cea8dfb865d",
"connections": {
"OCR folder": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Move failed": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"AI Agent-OCR": {
"main": [
[
{
"node": "Data Cleaner",
"type": "main",
"index": 0
}
],
[
{
"node": "Move failed",
"type": "main",
"index": 0
}
]
]
},
"Data Cleaner": {
"main": [
[
{
"node": "AirTable - Create a record1",
"type": "main",
"index": 0
}
],
[
{
"node": "Move failed",
"type": "main",
"index": 0
}
]
]
},
"Download file": {
"main": [
[
{
"node": "AI Agent-OCR",
"type": "main",
"index": 0
}
]
]
},
"file name & ID": {
"main": [
[
{
"node": "Download file",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Done!",
"type": "main",
"index": 0
}
],
[
{
"node": "file name & ID",
"type": "main",
"index": 0
}
]
]
},
"Move successful": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent-OCR",
"type": "ai_languageModel",
"index": 0
},
{
"node": "AI Agent-OCR",
"type": "ai_languageModel",
"index": 1
}
]
]
},
"AirTable - Create a record1": {
"main": [
[
{
"node": "Move successful",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 发票处理, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
自动向客户发送发票
通过 OCR.Space、GPT-4 和 Google Drive 到 Gmail 实现发票处理的自动化
If
Set
Code
+12
29 节点Michael Taleb
AI 摘要总结
宠物店 4
🐶 宠物店预约 AI 代理
If
Set
Code
+41
187 节点Bruno Dias
人工智能
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
AI 代理餐厅 [模板]
🤖 WhatsApp、Instagram 和 Messenger 的 AI 餐厅助手
If
N8n
Set
+37
239 节点Amanda Benks
其他
交付汉堡店MVP
🤖 餐厅与配送自动化的 AI 驱动 WhatsApp 助手
If
Set
Code
+37
152 节点Bruno Dias
Facebook页面评论管理机器人:回复、删除、封禁和通知
AI驱动的Facebook评论管理:自动回复、删除、封禁和通知
If
Set
Code
+18
59 节点SpaGreen Creative
社交媒体
工作流信息
难度等级
高级
节点数量18
分类2
节点类型10
作者
Ehsan
@ehsan-zHi! 👋 I'm Ehsan , a BI & Data Analyst and AI Specialist with a passion for automation! 🤖 I use n8n , Python , and SQL to build powerful data pipelines and turn complex data into real-world insights.
外部链接
在 n8n.io 查看 →
分享此工作流