使用 AI 数据提取、Google Drive 和 Sheets 自动化发票处理
高级
这是一个Miscellaneous, AI Summarization, Multimodal AI领域的自动化工作流,包含 29 个节点。主要使用 If, Set, SplitOut, GoogleDrive, GoogleSheets 等节点。 通过 AI 数据提取、Google Drive 和 Sheets 实现发票处理的自动化
前置要求
- •Google Drive API 凭证
- •Google Sheets API 凭证
- •OpenAI API Key
使用的节点 (29)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "051a8fba2e1c6188b420b5f55a07b296d40abc8a58f64f7a42438ab083c28197"
},
"nodes": [
{
"id": "0a5cd68e-9222-4880-bded-12aa813a02ce",
"name": "获取文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
688,
48
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "download"
},
"typeVersion": 3
},
{
"id": "d55b9a49-d54a-46f9-81d9-035c81a04d9b",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
416,
-64
],
"parameters": {
"color": 7,
"width": 403,
"height": 293,
"content": "## 从 PDF 提取文本"
},
"typeVersion": 1
},
{
"id": "7407a663-640e-4ad0-9add-b1062f6064d8",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
832,
-64
],
"parameters": {
"color": 7,
"width": 435,
"height": 293,
"content": "## 使用 AI 进行信息提取"
},
"typeVersion": 1
},
{
"id": "0b0f29e0-237c-4075-902a-7082b849b74f",
"name": "信息提取器",
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
"position": [
1008,
48
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemPromptTemplate": "Du bist ein erfahrener Extraktionsalgorithmus für Rechnungen.\nExtrahiere ausschließlich relevante Informationen aus dem Text.\nWenn du den Wert eines gefragten Attributs nicht erkennst, darfst du den Attributwert weglassen. Gebe Beträge immer mit Komma als Dezimaltrennzeichen (1,99 statt 1.99), für die deutsche Schreibweise."
},
"attributes": {
"attributes": [
{
"name": "Unternehmen",
"required": true,
"description": "Elisabeth HAKM"
},
{
"name": "Kunde",
"required": true,
"description": "Kundenname "
},
{
"name": "Rechnungsnummer",
"required": true,
"description": "Auf der Rechnung angegebene Rechnungsnummer"
},
{
"name": "Rechnungsdatum",
"required": true,
"description": "Das Rechnungsdatum im Format \"YYYY-mm-dd\". Ist kein solches erkennbar, nutze das Zahlungsdatum."
},
{
"name": "Nettobetrag",
"required": true,
"description": "Der Nettobetrag + € (ohne Mehrwertsteuer). Falls nicht explizit angegeben, berechne ihn aus dem Bruttobetrag und dem Steuersatz."
},
{
"name": "Mehrwertsteuer",
"required": true,
"description": "Der Mehrwertsteuerbetrag."
},
{
"name": "Monat",
"required": true,
"description": "Der ausgeschriebene Monat des Rechnungsdatums (\"Januar\", \"Februar\". etc.)"
},
{
"name": "Jahr",
"required": true,
"description": "Der Jahr des Rechnungsdatums (\"2024\", \"2025\", etc.)"
},
{
"name": "Artikel",
"required": true,
"description": "Zähle alle Artikel zusammen "
},
{
"name": "Kundennummer",
"required": true,
"description": "Kundennummer"
}
]
}
},
"typeVersion": 1
},
{
"id": "8373c145-db20-4294-87eb-da985c84107b",
"name": "从PDF提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
864,
48
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "a2804a83-35b8-44fd-8c27-8c9529ce3032",
"name": "循环",
"type": "n8n-nodes-base.splitInBatches",
"position": [
448,
48
],
"parameters": {
"options": {}
},
"typeVersion": 3,
"alwaysOutputData": false
},
{
"id": "0f0a91ea-bcf4-4135-a2b5-f2c22863849d",
"name": "获取年度文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
1296,
48
],
"parameters": {
"filter": {
"driveId": {
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "list",
"value": "15m2uc0MJyvzv-QHvzXYu4Yfp4C2SG-ou",
"cachedResultUrl": "https://drive.google.com/drive/folders/15m2uc0MJyvzv-QHvzXYu4Yfp4C2SG-ou",
"cachedResultName": "Buchhaltung / Rechnungen"
}
},
"options": {},
"resource": "fileFolder",
"queryString": "={{ $json.output.Jahr }}"
},
"typeVersion": 3
},
{
"id": "172ed9b2-ee6c-4c9f-958f-49e7bfa22d7d",
"name": "获取月份文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
1456,
48
],
"parameters": {
"filter": {
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
}
},
"options": {},
"resource": "fileFolder",
"queryString": "={{ $('Information Extractor').item.json.output.Monat }}"
},
"typeVersion": 3,
"alwaysOutputData": false
},
{
"id": "b643e996-22f9-4603-aeb7-65c56e2e0513",
"name": "移动文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
1632,
48
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('GetFile').item.json.id }}"
},
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"operation": "move"
},
"typeVersion": 3
},
{
"id": "7dd0b378-27a7-412d-82a2-489ca554e742",
"name": "更新文件名",
"type": "n8n-nodes-base.googleDrive",
"position": [
1808,
48
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "update",
"newUpdatedFileName": "={{ $('Information Extractor').item.json.output.Kunde }} \n{{ $('Information Extractor').item.json.output.Monat }} {{ $('Information Extractor').item.json.output.Jahr }}"
},
"typeVersion": 3
},
{
"id": "b3d8208f-7e0a-4c52-a5ea-4808b457ca8f",
"name": "添加到概览",
"type": "n8n-nodes-base.googleSheets",
"position": [
2032,
48
],
"parameters": {
"columns": {
"value": {
"Jahr": "={{ $('Information Extractor').item.json.output.Jahr }}",
"MwST": "={{ $('Information Extractor').item.json.output.Mehrwertsteuer }}",
"Kunde": "={{ $('Information Extractor').item.json.output.Kunde }}",
"Monat": "={{ $('Information Extractor').item.json.output.Monat }}",
"Nettobetrag": "={{ $('Information Extractor').item.json.output.Nettobetrag }}",
"Kundennummer": "={{ $('Information Extractor').item.json.output.Kundennummer }}",
"Rechnungsdatum": "={{ $('Information Extractor').item.json.output.Rechnungsdatum }}",
"Rechnungsnummer": "={{ $('Information Extractor').item.json.output.Rechnungsnummer }}",
"Elisabeth Standort": "={{ $('Information Extractor').item.json.output.Unternehmen }}"
},
"schema": [
{
"id": "Kundennummer",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Kundennummer",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Kunde",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Kunde",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Elisabeth Standort",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Elisabeth Standort",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Rechnungsdatum",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Rechnungsdatum",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Rechnungsnummer",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Rechnungsnummer",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "MwST",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "MwST",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Nettobetrag",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Nettobetrag",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Monat",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Monat",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Jahr",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Jahr",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Datei",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Datei",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Ia3tDmpdMXi1Dt_grlnM_LcGp_4TVr_2KivXTspBPoI/edit#gid=0",
"cachedResultName": "Tabellenblatt1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "11mzYAgYMJFAtpHCHtDbTogUPdwLLywzbTxjR-UR2DY8",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/11mzYAgYMJFAtpHCHtDbTogUPdwLLywzbTxjR-UR2DY8/edit?usp=drivesdk",
"cachedResultName": "Buchaltung / rechnungen"
}
},
"typeVersion": 4.5
},
{
"id": "b0f0b691-2d65-4509-a1f4-c53c023369e9",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1280,
-64
],
"parameters": {
"color": 7,
"width": 671,
"height": 293,
"content": "## 将发票移动到相应文件夹并重命名"
},
"typeVersion": 1
},
{
"id": "355e53d3-c12e-48cb-90a7-79e44f799bfb",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
2000,
-64
],
"parameters": {
"color": 7,
"width": 207,
"height": 293,
"content": "## 记录文档"
},
"typeVersion": 1
},
{
"id": "2f706eb5-4f51-4156-913d-4d1cd107c57e",
"name": "搜索文件和文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
256,
48
],
"parameters": {
"filter": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "1Zc6vLxnVqTX1oZbn5lj54bRntQaDOnqy",
"cachedResultUrl": "https://drive.google.com/drive/folders/1Zc6vLxnVqTX1oZbn5lj54bRntQaDOnqy",
"cachedResultName": "Rechnungsablage"
}
},
"options": {},
"resource": "fileFolder"
},
"typeVersion": 3
},
{
"id": "1620598b-aace-4c65-9408-8d34c1aeaf61",
"name": "Google Drive 触发器",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
96,
48
],
"parameters": {
"event": "fileCreated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1Zc6vLxnVqTX1oZbn5lj54bRntQaDOnqy",
"cachedResultUrl": "https://drive.google.com/drive/folders/1Zc6vLxnVqTX1oZbn5lj54bRntQaDOnqy",
"cachedResultName": "Rechnungsablage"
}
},
"typeVersion": 1
},
{
"id": "fce00738-71de-41e4-91ed-ff1cd0b0b90c",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
944,
256
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "6fec458f-6966-47ef-800a-fc7291c89d4f",
"name": "年度文件夹已存在?",
"type": "n8n-nodes-base.googleDrive",
"position": [
976,
-624
],
"parameters": {
"filter": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "15m2uc0MJyvzv-QHvzXYu4Yfp4C2SG-ou",
"cachedResultUrl": "https://drive.google.com/drive/folders/15m2uc0MJyvzv-QHvzXYu4Yfp4C2SG-ou",
"cachedResultName": "Buchhaltung / Rechnungen"
}
},
"options": {},
"resource": "fileFolder",
"returnAll": true,
"queryString": "={{ $json.jahr }}"
},
"typeVersion": 3,
"alwaysOutputData": true
},
{
"id": "ffc3e80a-331d-4e04-90e7-8128f3a56c22",
"name": "创建年度文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
1376,
-656
],
"parameters": {
"name": "={{ $('Loop Over Items').item.json.jahr }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "15m2uc0MJyvzv-QHvzXYu4Yfp4C2SG-ou",
"cachedResultUrl": "https://drive.google.com/drive/folders/15m2uc0MJyvzv-QHvzXYu4Yfp4C2SG-ou",
"cachedResultName": "Buchhaltung / Rechnungen"
},
"resource": "folder"
},
"typeVersion": 3
},
{
"id": "a9b953c5-65fa-43dd-9ab5-d7318dfded48",
"name": "插入月份文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
1904,
-576
],
"parameters": {
"name": "={{ $json.monate }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Jahresordner erstellen').item.json.id }}"
},
"resource": "folder"
},
"typeVersion": 3
},
{
"id": "06c01fd7-7c2f-49ee-83f2-1cd3015ac40f",
"name": "拆分输出1",
"type": "n8n-nodes-base.splitOut",
"position": [
1712,
-656
],
"parameters": {
"options": {},
"fieldToSplitOut": "monate"
},
"typeVersion": 1
},
{
"id": "587f8a5e-cf80-492c-878b-7425fad5bdb1",
"name": "月份列表",
"type": "n8n-nodes-base.set",
"position": [
1552,
-656
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "3d0336a2-4706-42ad-9b5a-b1ba22f7c859",
"name": "monate",
"type": "array",
"value": " [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"]"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "be4e4b96-3f3f-4748-adb6-bbcc971f5735",
"name": "选择年份",
"type": "n8n-nodes-base.set",
"position": [
352,
-656
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e8e78387-492a-4668-97d6-e5be1e512661",
"name": "jahr",
"type": "array",
"value": "[2024, 2025, 2026]"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ccdfdfad-5274-478e-8df3-0edc92009a10",
"name": "分离输出",
"type": "n8n-nodes-base.splitOut",
"position": [
544,
-656
],
"parameters": {
"options": {},
"fieldToSplitOut": "jahr"
},
"typeVersion": 1
},
{
"id": "9331d30f-00c5-4280-9839-1962567491b5",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
736,
-656
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "5a940700-4503-46bd-9cfa-137dbde8334a",
"name": "文件夹尚不存在",
"type": "n8n-nodes-base.if",
"position": [
1184,
-624
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8947703c-9256-4466-be49-0480aaace705",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.isEmpty() }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "76c34fbf-4a00-4550-bca3-74c053b6512a",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
-752
],
"parameters": {
"width": 352,
"height": 384,
"content": "## 创建年度 / 月份文件夹"
},
"typeVersion": 1
},
{
"id": "cccb756b-6c98-4b03-9694-bafea20b850f",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
288,
-800
],
"parameters": {
"color": 5,
"width": 1872,
"height": 544,
"content": "# 创建发票文件夹"
},
"typeVersion": 1
},
{
"id": "ee2a84b2-2a56-4cda-b555-425680607b74",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
64,
-240
],
"parameters": {
"color": 3,
"width": 2160,
"height": 688,
"content": "# 处理传入发票"
},
"typeVersion": 1
},
{
"id": "1099fef3-f704-4da8-afc9-9dc39e51c485",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-576,
-288
],
"parameters": {
"color": 4,
"width": 576,
"height": 800,
"content": "🧾 自动化发票处理 - n8n 工作流"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Loop": {
"main": [
[],
[
{
"node": "GetFile",
"type": "main",
"index": 0
}
]
]
},
"GetFile": {
"main": [
[
{
"node": "ExtractFromPDF",
"type": "main",
"index": 0
}
]
]
},
"MoveFile": {
"main": [
[
{
"node": "UpdateFileName",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Split Out1": {
"main": [
[
{
"node": "Monatsordner einfügen",
"type": "main",
"index": 0
}
]
]
},
"AddToOverview": {
"main": [
[
{
"node": "Loop",
"type": "main",
"index": 0
}
]
]
},
"GetYearFolder": {
"main": [
[
{
"node": "GetMonthFolder",
"type": "main",
"index": 0
}
]
]
},
"ExtractFromPDF": {
"main": [
[
{
"node": "Information Extractor",
"type": "main",
"index": 0
}
]
]
},
"GetMonthFolder": {
"main": [
[
{
"node": "MoveFile",
"type": "main",
"index": 0
}
]
]
},
"UpdateFileName": {
"main": [
[
{
"node": "AddToOverview",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Jahresordner schon vorhanden?",
"type": "main",
"index": 0
}
]
]
},
"Jahre auswählen": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"Monate als Liste": {
"main": [
[
{
"node": "Split Out1",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Information Extractor",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Google Drive Trigger": {
"main": [
[
{
"node": "Search files and folders",
"type": "main",
"index": 0
}
]
]
},
"Information Extractor": {
"main": [
[
{
"node": "GetYearFolder",
"type": "main",
"index": 0
}
]
]
},
"Jahresordner erstellen": {
"main": [
[
{
"node": "Monate als Liste",
"type": "main",
"index": 0
}
]
]
},
"Monatsordner einfügen": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Search files and folders": {
"main": [
[
{
"node": "Loop",
"type": "main",
"index": 0
}
]
]
},
"Ordner noch nicht vorhanden": {
"main": [
[
{
"node": "Jahresordner erstellen",
"type": "main",
"index": 0
}
],
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Jahresordner schon vorhanden?": {
"main": [
[
{
"node": "Ordner noch nicht vorhanden",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 杂项, AI 摘要总结, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用ScrapeGraph AI提取n8n社区最近添加的工作流
使用ScrapeGraphAI和Gemini提取和存储n8n社区最近添加的工作流
Set
Merge
Split Out
+12
21 节点Davide
杂项
使用Google Drive、OCR和OpenAI处理扫描发票到Google表格
使用Google Drive、OCR和OpenAI处理扫描发票到Google表格
If
Set
Html
+13
24 节点Ovadia Rocks
发票处理
自动化B2B潜在客户生成:Google Places、Scrape.do与AI数据增强
自动化B2B潜在客户生成:Google Places、Scrape.do与AI数据增强
If
Set
Html
+9
19 节点Onur
杂项
每日 WhatsApp 群组智能分析:GPT-4.1 分析与语音消息转录
每日 WhatsApp 群组智能分析:GPT-4.1 分析与语音消息转录
If
Set
Code
+20
52 节点Daniel Lianes
杂项
上下文混合RAG AI文案
Google Drive到Supabase上下文向量数据库同步用于RAG应用
If
Set
Code
+25
76 节点Michael Taleb
AI RAG 检索增强
LinkedIn职位搜索
LinkedIn职位搜索:自动匹配简历(GPT/Gemini)+求职信生成器+Telegram提醒
If
Set
Code
+13
33 节点Hojjat Jashnniloofar
个人效率