从非结构化数据到结构化数据
高级
这是一个Document Extraction、AI Summarization领域的自动化工作流,包含 16 个节点。主要使用 DataTable、GmailTrigger、DataTableTool、EmailReadImap、Agent 等节点。 行动计划:使用OpenAI模型处理邮件源和数据表
前置要求
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
- •Google Gemini API Key
使用的节点 (16 个)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "zGGBdrGLXA50cO1A",
"meta": {
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
"templateCredsSetupCompleted": true
},
"name": "从非结构化数据到结构化数据",
"tags": [],
"nodes": [
{
"id": "97cce9f4-cb8e-4ea7-872b-e1f8054afc3a",
"name": "Gmail 触发器",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-480,
-224
],
"parameters": {
"filters": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "nyuHvSX5HuqfMPlW",
"name": "Gmail account (n3w.it)"
}
},
"typeVersion": 1.3
},
{
"id": "13fffb5b-724c-4adf-8c99-5e16f10a5324",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-112,
160
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "TefveNaDaMERl1hY",
"name": "OpenAi account (Eure)"
}
},
"typeVersion": 1.2
},
{
"id": "90d9983b-b4a6-427f-970c-388bae72fb1f",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
128,
160
],
"parameters": {
"autoFix": true,
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"from\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"to\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"subject\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"summarize\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
},
"typeVersion": 1.3
},
{
"id": "1165ea37-01f5-4835-b04d-c91395519e04",
"name": "OpenAI 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
80,
336
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "TefveNaDaMERl1hY",
"name": "OpenAi account (Eure)"
}
},
"typeVersion": 1.2
},
{
"id": "481c0914-84c3-4c5f-9247-ec709bf18e53",
"name": "插入行",
"type": "n8n-nodes-base.dataTable",
"position": [
288,
-64
],
"parameters": {
"columns": {
"value": {
"To": "={{ $json.output.to }}",
"From": "={{ $json.output.from }}",
"Subject": "={{ $json.output.subject }}",
"Summary": "={{ $json.output.summarize }}"
},
"schema": [
{
"id": "From",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "From",
"defaultMatch": false
},
{
"id": "Subject",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "Subject",
"defaultMatch": false
},
{
"id": "Summary",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "Summary",
"defaultMatch": false
},
{
"id": "To",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "To",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "LZKeHWCZU60XbKyM",
"cachedResultUrl": "/projects/mfFxBtuhQcXKlWHw/datatables/LZKeHWCZU60XbKyM",
"cachedResultName": "Email output parser"
}
},
"typeVersion": 1
},
{
"id": "ca682a7e-9630-4c8b-b8eb-17f557354eb8",
"name": "邮箱触发器(IMAP)",
"type": "n8n-nodes-base.emailReadImap",
"position": [
-480,
-64
],
"parameters": {
"options": {}
},
"credentials": {
"imap": {
"id": "k31W9oGddl9pMDy4",
"name": "IMAP info@n3witalia.com"
}
},
"typeVersion": 2.1
},
{
"id": "15c2dbd5-6e23-4920-843a-7ce7a43fdcf5",
"name": "Microsoft Outlook 触发器",
"type": "n8n-nodes-base.microsoftOutlookTrigger",
"position": [
-480,
80
],
"parameters": {
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "oYlYok8LYOhL04rM",
"name": "Microsoft Outlook account (dave85heat@hotmail.it)"
}
},
"typeVersion": 1
},
{
"id": "04dc1bd7-6ecb-457f-835b-e67b910e30ad",
"name": "解析代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-64,
-64
],
"parameters": {
"text": "={{JSON.stringify($json)}}",
"options": {
"systemMessage": "=**Role:**\nYou are a data extraction and parsing agent integrated in an n8n workflow.\n\n**Goal:**\nGiven a JSON input containing one or more emails , your task is to parse and extract structured information from the email content.\n\n**Instructions:**\n\n1. Carefully read the email content provided in the `body` field of the JSON input.\n2. Identify and extract key entities and data points mentioned in the text \n3. Return the extracted data in a **clean, structured JSON format**.\n4. If specific data cannot be found, return the field as `null` instead of omitting it.\n5. Preserve the original structure of the input email list, so that each parsed result corresponds to the same email in the input array.\n6. Do not include any explanations, reasoning, or text outside of JSON.\n\n**Important:**\n\n* Be consistent with field names and data formats (use ISO 8601 for dates, plain strings for text).\n* Never return unstructured text or commentary — only valid JSON.\n* Output should always be a JSON array of parsed objects."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "b0d03646-57f1-4eb0-8f1c-3c27c3900466",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-512,
-928
],
"parameters": {
"color": 3,
"width": 976,
"height": 400,
"content": "## 如何使用AI代理将非结构化邮箱数据转换为结构化格式"
},
"typeVersion": 1
},
{
"id": "17751b90-4db6-45d7-b426-db157e1199db",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-512,
-512
],
"parameters": {
"width": 480,
"height": 176,
"content": "## 步骤1"
},
"typeVersion": 1
},
{
"id": "fc864e0b-f04e-4996-a012-fbe7ad52dc6b",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-16,
-512
],
"parameters": {
"width": 480,
"height": 176,
"content": "## 步骤2"
},
"typeVersion": 1
},
{
"id": "ebabb739-ecb9-450b-abb5-1d27d6a95832",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
112,
96
],
"parameters": {
"width": 272,
"height": 176,
"content": "从json设置结构化数据"
},
"typeVersion": 1
},
{
"id": "84b10b19-a1a2-4fac-b791-8ef5aa1160c6",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
576,
-64
],
"webhookId": "cd94eebb-fa9b-4b7e-b4ed-09ddfd80fbf0",
"parameters": {
"options": {}
},
"typeVersion": 1.3
},
{
"id": "e846ffd6-7ee5-4486-9f6d-a73f349814b9",
"name": "邮件代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
880,
-64
],
"parameters": {
"options": {
"systemMessage": "You are a helpful assistant.\n\nUse always the \"Emails\" tool to search for the request."
}
},
"typeVersion": 2.2
},
{
"id": "c833e8c1-68d5-421c-9f71-0d928b14ad19",
"name": "邮件",
"type": "n8n-nodes-base.dataTableTool",
"position": [
1056,
160
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "From",
"keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions0_Value', `Search the emails sent from`, 'string') }}",
"condition": "ilike"
},
{
"keyName": "Subject",
"keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions1_Value', `Search the emails with these subject`, 'string') }}",
"condition": "ilike"
},
{
"keyName": "To",
"keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions2_Value', `Search the emails sent to`, 'string') }}",
"condition": "ilike"
},
{
"keyName": "Summary",
"keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions3_Value', `Search the emails with these summaries`, 'string') }}",
"condition": "ilike"
}
]
},
"operation": "get",
"returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "LZKeHWCZU60XbKyM",
"cachedResultUrl": "/projects/mfFxBtuhQcXKlWHw/datatables/LZKeHWCZU60XbKyM",
"cachedResultName": "Email output parser"
}
},
"typeVersion": 1
},
{
"id": "16feafab-fa9e-4acb-85b5-cd04e6b621d0",
"name": "Google Gemini聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
800,
144
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "0p34rXqIqy8WuoPg",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "7527b0d6-cf52-4bd1-81d5-ad39002dda1f",
"connections": {
"Emails": {
"ai_tool": [
[
{
"node": "Email Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Parsing Agent",
"type": "main",
"index": 0
}
]
]
},
"Parsing Agent": {
"main": [
[
{
"node": "Insert row",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Parsing Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Structured Output Parser",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Email Trigger (IMAP)": {
"main": [
[
{
"node": "Parsing Agent",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Email Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Parsing Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Microsoft Outlook Trigger": {
"main": [
[
{
"node": "Parsing Agent",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Email Agent",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个高级难度的工作流,适用于Document Extraction、AI Summarization等场景。适合高级用户,包含 16+ 个节点的复杂工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
工作简历与求职信自动化(含简历 HTML 模板)
使用 AI、GitHub Pages 和 Google Drive 个性化简历和求职信
Set
Code
Html
+16
31 节点Michael A Putra
Document Extraction
基于输入类型动态选择模型
智能 AI 路由:根据内容类型将查询定向至 GPT、Claude、Gemini 或 Perplexity
Agent
Chain Llm
Chat Trigger
+8
12 节点Davide
Engineering
Fireflies会议转录和摘要自动化
使用Gemini和Gmail从Fireflies转录自动化会议摘要
Set
Code
Gmail
+11
26 节点Davide
Document Extraction
自动化学术论文元数据及变量提取,从Gemini到Google Sheets
自动化学术论文元数据及变量提取,从Gemini到Google Sheets
Set
Code
Wait
+14
39 节点OwenLee
Document Extraction
使用ScrapeGraph AI提取n8n社区最近添加的工作流
使用ScrapeGraphAI和Gemini提取和存储n8n社区最近添加的工作流
Set
Merge
Split Out
+12
21 节点Davide
Miscellaneous
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
Other
工作流信息
难度等级
高级
节点数量16
分类2
节点类型11
作者
Davide
@n3witaliaFull-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza
外部链接
在 n8n.io 上查看 →
分享此工作流