PO_发票匹配_V1
高级
这是一个Invoice Processing, AI Summarization领域的自动化工作流,包含 19 个节点。主要使用 If, Switch, GoogleDrive, GoogleSheets, Agent 等节点。 基于 Google Gemini AI 和邮件通知的自动化发票-PO 匹配
前置要求
- •Google Drive API 凭证
- •Google Sheets API 凭证
- •Google Gemini API Key
使用的节点 (19)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "BYzxNRz3ownaQd4R",
"meta": {
"instanceId": "e0f9933c2de40fd346dddfe612cf584d10411f4630c7e4f4f3436a3c24dfa368",
"templateCredsSetupCompleted": true
},
"name": "PO_发票匹配_V1",
"tags": [],
"nodes": [
{
"id": "67440d4f-4122-4732-92a4-cf62bf064159",
"name": "Google Drive 触发器",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-992,
-208
],
"parameters": {
"event": "fileCreated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1cxnSBv6t7SAgJDJZxAOtPXO0RZH7rfKf",
"cachedResultUrl": "https://drive.google.com/drive/folders/1cxnSBv6t7SAgJDJZxAOtPXO0RZH7rfKf",
"cachedResultName": "Invoices"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "cGpadX1wEqUPmfdd",
"name": "Mail4matheen"
}
},
"typeVersion": 1
},
{
"id": "98a803af-25a6-4933-a0eb-29afa7fe95ac",
"name": "下载文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
-768,
-208
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "cGpadX1wEqUPmfdd",
"name": "Mail4matheen"
}
},
"typeVersion": 3
},
{
"id": "ecadedd7-ba41-4212-8ec0-57c8ce47d075",
"name": "从文件中提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
-544,
-208
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "301efe65-f9d1-41d4-9b9b-1727eec6e2ac",
"name": "信息提取器",
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
"position": [
-320,
-208
],
"parameters": {
"text": "={{ $json.text }}",
"options": {},
"attributes": {
"attributes": [
{
"name": "Vendor Name",
"required": true,
"description": "vendor name from whom teh invoice came"
},
{
"name": "Invoice Number",
"required": true,
"description": "Invoice number"
},
{
"name": "Invoice Date",
"required": true,
"description": "Invoice date from the invoice"
},
{
"name": "Total Amount",
"type": "number",
"required": true,
"description": "Total amount including the tax amount"
},
{
"name": "PO Number",
"required": true,
"description": "PO number from invoice"
},
{
"name": "PO Date",
"required": true,
"description": "PO date from invoice"
},
{
"name": "Qty",
"type": "number",
"required": true,
"description": "Quantity from invoice"
},
{
"name": "Rate",
"type": "number",
"required": true,
"description": "rate from invoice table"
},
{
"name": "Net Amount",
"required": true,
"description": "Net Amount Excluding Tax"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "ec28ded6-e060-481d-9434-c1b86130ac67",
"name": "Google Gemini 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-256,
16
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "AaiLYcmkHuNwDORB",
"name": "Google Gemini(PaLM) Api account 4"
}
},
"typeVersion": 1
},
{
"id": "70cf4980-33f4-4c61-ac16-e3ea16fbf92c",
"name": "切换",
"type": "n8n-nodes-base.switch",
"position": [
32,
-208
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Hight Dollar",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0e897f8d-3ee6-470a-a090-16766c79f679",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "={{ $json.output['Total Amount'] }}",
"rightValue": 5000
}
]
},
"renameOutput": true
},
{
"outputKey": "Direct Payment",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "338c9b39-e0ef-43fd-9dce-efd2fed4adf7",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $json.output['Total Amount'] }}",
"rightValue": 5000
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.3
},
{
"id": "23b35100-3876-4f9f-bcca-52710f96f354",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
320,
-256
],
"parameters": {
"text": "={{ $json.output['PO Number'] }}\n{{ $json.output['PO Date'] }}\n{{ $json.output.Qty }}\n{{ $json.output.Rate }}\n{{ $json.output['Net Amount'] }}",
"options": {
"systemMessage": "=You are expert in finance checker. \n\n\nYou task is to verify the the details from from PO_DB tool\n\n\nIf all are matched then update the invoice number {{ $json.output['Invoice Number'] }} in the Upadet_Row tool \n\nUpdate \"MATCHING\" OR \"NOT MATCHING\" in the matching or not matching column in Upadet_Row\n\nUpdate the comments on the matching on the \"Remarks\" column of Upadet_Row tool\n\nIf matching give a seprate output as TRUE or give as FALSE\nAlso send teh remarks to the as output\n\n{\n\"match\":TRUE\n\"remarks\":\"value\"\n\n}\n"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "664fe47a-83cb-4cfd-b210-a175b0d6a312",
"name": "Google Gemini 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
256,
-32
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "AaiLYcmkHuNwDORB",
"name": "Google Gemini(PaLM) Api account 4"
}
},
"typeVersion": 1
},
{
"id": "6604eac1-8429-4dad-9ede-350fd8d2b591",
"name": "PO_数据库",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
384,
-32
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1T-H7zfvdx6NgBPrlveD8hXeW2q38VhtO_aO_2Sik1M0/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1T-H7zfvdx6NgBPrlveD8hXeW2q38VhtO_aO_2Sik1M0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1T-H7zfvdx6NgBPrlveD8hXeW2q38VhtO_aO_2Sik1M0/edit?usp=drivesdk",
"cachedResultName": "PO_Data"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "xw7WRgAozbgAiIjH",
"name": "Google Sheets account 6"
}
},
"typeVersion": 4.7
},
{
"id": "10a033f5-b15d-402d-81c1-a9ee6753b90e",
"name": "更新_行",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
512,
-32
],
"parameters": {
"columns": {
"value": {
"Remarks": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Remarks', ``, 'string') }}",
"PO Number": "={{ $json.output['PO Number'] }}",
"Invoice Number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Invoice_Number', ``, 'string') }}",
"Matching or Not Matching": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Matching_or_Not_Matching', ``, 'string') }}"
},
"schema": [
{
"id": "PO Number",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "PO Number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Vendor Name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Vendor Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "PO Date",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "PO Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Qty",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Qty",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Rate",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Rate",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Amount",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Amount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Tax",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Tax",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Total Amount",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Total Amount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Invoice Number",
"type": "string",
"display": true,
"required": false,
"displayName": "Invoice Number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Matching or Not Matching",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Matching or Not Matching",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Remarks",
"type": "string",
"display": true,
"required": false,
"displayName": "Remarks",
"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": [
"PO Number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1T-H7zfvdx6NgBPrlveD8hXeW2q38VhtO_aO_2Sik1M0/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1T-H7zfvdx6NgBPrlveD8hXeW2q38VhtO_aO_2Sik1M0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1T-H7zfvdx6NgBPrlveD8hXeW2q38VhtO_aO_2Sik1M0/edit?usp=drivesdk",
"cachedResultName": "PO_Data"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "xw7WRgAozbgAiIjH",
"name": "Google Sheets account 6"
}
},
"typeVersion": 4.7
},
{
"id": "860e77ab-9c58-4548-be34-7d8bbff8a06a",
"name": "条件判断",
"type": "n8n-nodes-base.if",
"position": [
720,
-256
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7c2043db-c9cb-4366-b04f-be71973234de",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.match }}",
"rightValue": "true"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "79803fd2-cea1-4f89-80bb-2263774b12dd",
"name": "在表格中追加行",
"type": "n8n-nodes-base.googleSheets",
"position": [
928,
-416
],
"parameters": {
"columns": {
"value": {
"Qty": "={{ $('Switch').item.json.output.Qty }}",
"Tax": "0",
"Rate": "={{ $('Switch').item.json.output.Rate }}",
"Amount": "={{ $('Switch').item.json.output['Net Amount'] }}",
"Status": "Process payment",
"PO Date": "={{ $('Switch').item.json.output['PO Date'] }}",
"PO Number": "={{ $('Switch').item.json.output['PO Number'] }}",
"Vendor Name": "={{ $('Switch').item.json.output['Vendor Name'] }}",
"Total Amount": "={{ $('Switch').item.json.output['Net Amount'] }}",
"Invoice Number": "={{ $('Switch').item.json.output['Invoice Number'] }}"
},
"schema": [
{
"id": "PO Number",
"type": "string",
"display": true,
"required": false,
"displayName": "PO Number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Vendor Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Vendor Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "PO Date",
"type": "string",
"display": true,
"required": false,
"displayName": "PO Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Qty",
"type": "string",
"display": true,
"required": false,
"displayName": "Qty",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Rate",
"type": "string",
"display": true,
"required": false,
"displayName": "Rate",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Amount",
"type": "string",
"display": true,
"required": false,
"displayName": "Amount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Tax",
"type": "string",
"display": true,
"required": false,
"displayName": "Tax",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Total Amount",
"type": "string",
"display": true,
"required": false,
"displayName": "Total Amount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Invoice Number",
"type": "string",
"display": true,
"required": false,
"displayName": "Invoice Number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1km2dOTGoExdJjaQvXYMlz80IvnCHSAPY6kL1AavomUo/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1km2dOTGoExdJjaQvXYMlz80IvnCHSAPY6kL1AavomUo",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1km2dOTGoExdJjaQvXYMlz80IvnCHSAPY6kL1AavomUo/edit?usp=drivesdk",
"cachedResultName": "Payment Process"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "xw7WRgAozbgAiIjH",
"name": "Google Sheets account 6"
}
},
"typeVersion": 4.7
},
{
"id": "bd4a913c-2fd9-4f19-b712-eecfc766e814",
"name": "发送消息",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
960,
-80
],
"webhookId": "c400ae17-32f7-47ed-b3bf-0fdc1769da03",
"parameters": {
"subject": "=Invoice # {{ $('Information Extractor').item.json.output['Invoice Number'] }} Not Matching\n\n\n",
"bodyContent": "=Hi Team,\n\n\nThe invoice # {{ $('Switch').item.json.output['Invoice Number'] }} doent match with PO {{ $('Switch').item.json.output['PO Number'] }}\n\nRemarks: {{ $json.output.remarks }}\n\n\nThanks",
"toRecipients": "abdul.matheen@teamhgs.com",
"additionalFields": {}
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "huBeQagYhJvL55GW",
"name": "Microsoft Outlook account 3"
}
},
"typeVersion": 2
},
{
"id": "fd896f77-5a44-4772-bf2b-fb258c639ec1",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
640,
96
],
"parameters": {
"jsonSchemaExample": "{\n\"match\":\"true\",\n\"remarks\":\"Invoice macthed\"\n\n}\n"
},
"typeVersion": 1.3
},
{
"id": "44330d6b-06af-4d6b-864e-91c243adb29a",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1104,
-592
],
"parameters": {
"width": 688,
"height": 320,
"content": "## 发票 PO 匹配流程"
},
"typeVersion": 1
},
{
"id": "b3d2c3de-2632-46d7-bbfe-a50faf2b293a",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1040,
-224
],
"parameters": {
"color": 3,
"width": 1024,
"height": 224,
"content": "提取发票数据并从发票中提取所需信息"
},
"typeVersion": 1
},
{
"id": "2c8ccecd-6fdf-4bbf-995c-3d6269966477",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
-432
],
"parameters": {
"width": 528,
"content": "检查金额是否大于 5000 并与 PO 数据库验证"
},
"typeVersion": 1
},
{
"id": "6826e75f-1496-4abd-b2a3-4ebabe0b9dd5",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
784,
-592
],
"parameters": {
"width": 320,
"content": "支付流程审批"
},
"typeVersion": 1
},
{
"id": "ac78f8cc-0413-40df-a6df-8de8175b9003",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
80
],
"parameters": {
"width": 320,
"content": "如果不匹配则发送电子邮件"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "d1ea1b19-2a18-45af-97df-1bf1e2710996",
"connections": {
"If": {
"main": [
[
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
],
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
},
"PO_DB": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Update_Row": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Download file": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "Information Extractor",
"type": "main",
"index": 0
}
]
]
},
"Google Drive Trigger": {
"main": [
[
{
"node": "Download file",
"type": "main",
"index": 0
}
]
]
},
"Information Extractor": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Information Extractor",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Google Gemini Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 发票处理, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
第一轮快速通道AI招聘助手
通过Gemini AI分析从Gmail到Slack和Google Sheets的快速简历筛选
If
Set
Code
+15
50 节点Dean Pike
AIAutomationPro终极RAG聊天机器人v1 n8n市场模板
多语言Telegram RAG聊天机器人,集成监督AI和自动化Google Drive流程
If
Set
Wait
+29
128 节点Daniel Ng
客服机器人
宠物店 4
🐶 宠物店预约 AI 代理
If
Set
Code
+41
187 节点Bruno Dias
人工智能
第一轮 Telegram 和 LinkedIn 快速通道 AI 招聘助手
AI候选人筛选流程:LinkedIn到Telegram,集成Gemini与Apify
If
Set
Code
+15
55 节点Dean Pike
人力资源
使用Google Drive、OCR和OpenAI处理扫描发票到Google表格
使用Google Drive、OCR和OpenAI处理扫描发票到Google表格
If
Set
Html
+13
24 节点Ovadia Rocks
发票处理
工作流信息
难度等级
高级
节点数量19
分类2
节点类型13
作者
Abdul Matheen
@matheenI am an automation consultant at a multinational company with 18 years of experience in automation technologies, including RPA, Python, and VBA. I am also expanding my expertise by learning AI Agents to further enhance my skill set. Currently serving as delivery manager for a automation team.
外部链接
在 n8n.io 查看 →
分享此工作流