从Outlook Excel附件自动化采购订单表单提交与AI
高级
这是一个AI领域的自动化工作流,包含 22 个节点。主要使用 If, Set, Code, ExtractFromFile, MicrosoftOutlook 等节点,结合人工智能技术实现智能自动化。 从Outlook Excel附件自动化采购订单表单提交与AI
前置要求
- •OpenAI API Key
使用的节点 (22)
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "b87cc222-82ec-4b46-9573-68f41d096969",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
620
],
"parameters": {
"color": 7,
"width": 740,
"height": 680,
"content": "## 2. 手动将XLSX转换为Markdown"
},
"typeVersion": 1
},
{
"id": "c4c55042-02c8-4364-ae7e-d1ec5a75437a",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1400,
620
],
"parameters": {
"color": 7,
"width": 640,
"height": 680,
"content": "## 3. 使用AI提取采购订单详情"
},
"typeVersion": 1
},
{
"id": "b9530f93-464b-4116-add7-da218fe8eb12",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-700,
-80
],
"parameters": {
"width": 460,
"height": 1400,
"content": "## 试试看!"
},
"typeVersion": 1
},
{
"id": "f5a2d1e7-f73b-4bfa-8e02-f30db275bbcc",
"name": "提取采购订单详情",
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
"position": [
1500,
920
],
"parameters": {
"text": "={{ $json.table }}",
"options": {
"systemPromptTemplate": "Capture the values as seen. Do not convert dates."
},
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"purchase_order_number\": { \"type\": \"string\" },\n \"purchase_order_date\": { \"type\": \"string\" },\n \"purchase_order_total\": { \"type\": \"number\" },\n \"vendor_name\": { \"type\": \"string\" },\n \"vendor_address\": { \"type\": \"string\" },\n \"vendor_contact\": { \"type\": \"string\" },\n \"delivery_contact\": { \"type\": \"string\" },\n \"delivery_address\": { \"type\": \"string\" },\n \"delivery_method\": { \"type\": \"string\" },\n \"items\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"description\": { \"type\": \"string\" },\n \"part_number\": { \"type\": \"string\" },\n \"quantity\": { \"type\": \"number\" },\n \"unit\": { \"type\": \"number\" },\n \"unit_price\": { \"type\": \"number\" }\n }\n }\n }\n }\n}"
},
"typeVersion": 1
},
{
"id": "0ce545f0-8147-4ad2-bb9e-14ef0b0c26ef",
"name": "是Excel文档吗?",
"type": "n8n-nodes-base.if",
"position": [
760,
1020
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f723ab0a-8f2d-4501-8273-fd6455c57cdd",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $binary.data.mimeType }}",
"rightValue": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "ccbd9531-66be-4e07-8b73-faf996622f9f",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-220,
460
],
"parameters": {
"color": 5,
"width": 340,
"height": 140,
"content": "### 采购订单示例"
},
"typeVersion": 1
},
{
"id": "ef8b00eb-dba6-47dd-a825-1aa5c85ee215",
"name": "运行检查",
"type": "n8n-nodes-base.set",
"position": [
2160,
940
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "049c7aca-7663-4eed-93b4-9eec3760c058",
"name": "has_po_number",
"type": "boolean",
"value": "={{ Boolean($json.output.purchase_order_number) }}"
},
{
"id": "94d2224a-cf81-4a42-acd0-de5276a5e493",
"name": "has_valid_po_date",
"type": "boolean",
"value": "={{ $json.output.purchase_order_date.toDateTime() < $now.plus({ 'day': 1 }) }}"
},
{
"id": "a8f69605-dad6-4ec2-a22f-d13ff99e27cd",
"name": "has_items",
"type": "boolean",
"value": "={{ $json.output.items.length > 0 }}"
},
{
"id": "c11db99e-9cc2-40b7-b3a5-f3c65f88dc13",
"name": "is_math_correct",
"type": "boolean",
"value": "={{\n$json.output.items.map(item => item.unit_price * item.quantity).sum().round(2) === $json.output.purchase_order_total.round(2) }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "801848cc-558c-4a30-aab5-eb403564b68f",
"name": "是有效的采购订单吗?",
"type": "n8n-nodes-base.if",
"position": [
2360,
940
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "11fa8087-7809-4bc9-9fbe-32bfd35821a6",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.has_po_number }}",
"rightValue": ""
},
{
"id": "c45ae85a-e060-4416-aa2c-daf58db8ba0e",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.has_valid_po_date }}",
"rightValue": ""
},
{
"id": "d0ae9518-2f4b-43fb-87b1-7108a6a75424",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.has_items }}",
"rightValue": ""
},
{
"id": "eed09f78-ce1a-4e09-8940-febcf7e41078",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.is_math_correct }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "7c7dd7a0-45fe-4549-8341-3b3fd18e1725",
"name": "从文件提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
980,
920
],
"parameters": {
"options": {
"rawData": true,
"headerRow": false,
"includeEmptyCells": true
},
"operation": "xlsx"
},
"typeVersion": 1
},
{
"id": "dfb6b00f-fe50-42d6-8597-8fdcb562714b",
"name": "XLSX到Markdown表格",
"type": "n8n-nodes-base.code",
"position": [
1180,
920
],
"parameters": {
"jsCode": "const rows = $input.all().map(item => item.json.row);\nconst maxLength = Math.max(...rows.map(row => row.length));\n\nconst table = [\n '|' + rows[0].join('|') + '|',\n '|' + Array(maxLength).fill(0).map(_ => '-').join('|') + '|',\n rows.slice(1, rows.length)\n .filter(row => row.some(Boolean))\n .map(row =>\n '|' + row.join('|') + '|'\n ).join('\\n')\n].join('\\n')\n\nreturn { table }"
},
"typeVersion": 2
},
{
"id": "1a3de516-1d21-4664-b2e3-8c8d6ec90ef2",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1600,
1080
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "8gccIjcuf3gvaoEr",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "1a29236f-5eaa-4a38-a0a1-6e19abd77d2c",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
2060,
620
],
"parameters": {
"color": 7,
"width": 940,
"height": 680,
"content": "## 4. 使用简单验证节省时间和精力"
},
"typeVersion": 1
},
{
"id": "79a39a03-5f71-4021-bcfd-06edbc285e8a",
"name": "回复无效格式",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
980,
1120
],
"webhookId": "9464583e-9505-49ec-865e-58aa1ab3c2ed",
"parameters": {
"message": "PO rejected due to invalid file format. Please try again with XLSX.",
"options": {},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Outlook Trigger').first().json.id }}"
},
"operation": "reply",
"additionalFields": {},
"replyToSenderOnly": true
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "EWg6sbhPKcM5y3Mr",
"name": "Microsoft Outlook account"
}
},
"typeVersion": 2
},
{
"id": "ec973438-4d6c-4d2e-8702-1d195f514528",
"name": "Outlook触发器",
"type": "n8n-nodes-base.microsoftOutlookTrigger",
"position": [
-120,
920
],
"parameters": {
"fields": [
"body",
"categories",
"conversationId",
"from",
"hasAttachments",
"internetMessageId",
"sender",
"subject",
"toRecipients",
"receivedDateTime",
"webLink"
],
"output": "fields",
"filters": {
"hasAttachments": true,
"foldersToInclude": []
},
"options": {
"downloadAttachments": true
},
"pollTimes": {
"item": [
{
"mode": "everyHour"
}
]
}
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "EWg6sbhPKcM5y3Mr",
"name": "Microsoft Outlook account"
}
},
"typeVersion": 1
},
{
"id": "fcb173ce-7dad-497a-9376-9650c2a24a84",
"name": "回复拒绝",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
2580,
1040
],
"webhookId": "9464583e-9505-49ec-865e-58aa1ab3c2ed",
"parameters": {
"message": "=PO Rejected due to the following errors:\n{{\n[\n !$json.has_po_number ? '* PO number was not provided' : '',\n !$json.has_valid_po_date ? '* PO date was missing or invalid' : '',\n !$json.has_items ? '* No line items detected' : '',\n !$json.is_math_correct ? '* Line items prices do not match up to PO total' : ''\n]\n .compact()\n .join('\\n')\n}}",
"options": {},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Outlook Trigger').first().json.id }}"
},
"operation": "reply",
"additionalFields": {},
"replyToSenderOnly": true
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "EWg6sbhPKcM5y3Mr",
"name": "Microsoft Outlook account"
}
},
"typeVersion": 2
},
{
"id": "64ced193-6b12-4ee9-b1e2-735040648051",
"name": "回复已接受",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
2580,
820
],
"webhookId": "9464583e-9505-49ec-865e-58aa1ab3c2ed",
"parameters": {
"message": "=Thank you for the purchase order.\nThis is an automated reply.",
"options": {},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Outlook Trigger').first().json.id }}"
},
"operation": "reply",
"additionalFields": {},
"replyToSenderOnly": true
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "EWg6sbhPKcM5y3Mr",
"name": "Microsoft Outlook account"
}
},
"typeVersion": 2
},
{
"id": "7bfe0e44-cd5d-4290-ba2e-0064c95bc4e2",
"name": "处理采购订单",
"type": "n8n-nodes-base.noOp",
"position": [
2800,
940
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6f517f2f-6072-46a2-8a9d-cca4e958d601",
"name": "修复Excel日期",
"type": "n8n-nodes-base.set",
"position": [
1840,
920
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={{\n{\n output: {\n ...$json.output,\n purchase_order_date: $json.output.purchase_order_date\n ? new Date((new Date(1900, 0, 1)).getTime() + (Number($json.output.purchase_order_date) - 2) * (24 * 60 * 60 * 1000))\n : $json.output.purchase_order_date\n }\n}\n}}"
},
"typeVersion": 3.4
},
{
"id": "f3a31b63-ebcb-4d93-8c5a-f626897b7d68",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-220,
620
],
"parameters": {
"color": 7,
"width": 840,
"height": 680,
"content": "## 1. 等待传入采购订单"
},
"typeVersion": 1
},
{
"id": "bb395dfc-2831-4e57-90c9-62f13f84302e",
"name": "正在提交采购订单吗?",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
80,
920
],
"parameters": {
"options": {
"fallback": "other"
},
"inputText": "=from: {{ $json.from.emailAddress.name }} <{{ $json.from.emailAddress.address }}>\nsubject: {{ $json.subject }}\nmessage:\n{{ $json.body.content }}",
"categories": {
"categories": [
{
"category": "is_purchase_order",
"description": "The message's intent is to submit a purchase order"
}
]
}
},
"typeVersion": 1
},
{
"id": "e52ec2e2-8be5-40ab-b1f8-8d7c0b161e1a",
"name": "不执行任何操作",
"type": "n8n-nodes-base.noOp",
"position": [
420,
1040
],
"parameters": {},
"typeVersion": 1
},
{
"id": "5ca6be4e-bc33-42d7-91bc-d30f7ccfdd25",
"name": "OpenAI 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
180,
1080
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "8gccIjcuf3gvaoEr",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
}
],
"pinData": {},
"connections": {
"Run Checks": {
"main": [
[
{
"node": "Is Valid Purchase Order?",
"type": "main",
"index": 0
}
]
]
},
"Reply Accepted": {
"main": [
[
{
"node": "Do Something with Purchase Order",
"type": "main",
"index": 0
}
]
]
},
"Fix Excel Dates": {
"main": [
[
{
"node": "Run Checks",
"type": "main",
"index": 0
}
]
]
},
"Outlook Trigger": {
"main": [
[
{
"node": "Is Submitting a Purchase Order?",
"type": "main",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "XLSX to Markdown Table",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Extract Purchase Order Details",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Is Excel Document?": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
],
[
{
"node": "Reply Invalid Format",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Is Submitting a Purchase Order?",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"XLSX to Markdown Table": {
"main": [
[
{
"node": "Extract Purchase Order Details",
"type": "main",
"index": 0
}
]
]
},
"Is Valid Purchase Order?": {
"main": [
[
{
"node": "Reply Accepted",
"type": "main",
"index": 0
}
],
[
{
"node": "Reply Rejection",
"type": "main",
"index": 0
}
]
]
},
"Extract Purchase Order Details": {
"main": [
[
{
"node": "Fix Excel Dates",
"type": "main",
"index": 0
}
]
]
},
"Is Submitting a Purchase Order?": {
"main": [
[
{
"node": "Is Excel Document?",
"type": "main",
"index": 0
}
],
[
{
"node": "Do Nothing",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI文档理解解析Outlook发票
使用AI文档理解解析Outlook发票
If
Set
Code
+13
24 节点Jimleuk
财务
自动化 Discord 垃圾信息审核
结合 AI 和人机协作的自动化 Discord 垃圾信息审核
If
Set
Code
+14
30 节点Jimleuk
人工智能
基于动态提示与Airtable的AI数据提取
通过动态提示与Airtable实现AI数据提取
Set
Code
Filter
+11
51 节点Jimleuk
人工智能
基于动态提示和Baserow的AI数据提取
基于动态提示和Baserow的AI数据提取
Set
Code
Filter
+10
45 节点Jimleuk
人工智能
使用JIRA、Supabase和AI自动分配支持工单
使用JIRA、Supabase和AI自动分配支持工单
If
Set
Jira
+15
36 节点Jimleuk
客户支持
使用Excel、Outlook和AI的每日新闻简报服务
使用Excel、Outlook和AI的每日新闻简报服务
If
Set
Html
+13
33 节点Jimleuk
人工智能
工作流信息
难度等级
高级
节点数量22
分类1
节点类型11
作者
Jimleuk
@jimleukFreelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at hello@jimle.uk LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk
外部链接
在 n8n.io 查看 →
分享此工作流