从Google Sheets到Google Docs自动发票生成器
中级
这是一个Document Extraction领域的自动化工作流,包含 11 个节点。主要使用 Merge, GoogleDocs, GoogleSheets, ManualTrigger 等节点。 从Google Sheets到Google Docs自动发票生成器
前置要求
- •Google Sheets API 凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "efb474b59b0341d7791932605bd9ff04a6c7ed9941fdd53dc4a2e4b99a6f9439",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "ede2cb2e-bb56-4870-94a4-c27c78509124",
"name": "当点击“执行工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-420,
560
],
"parameters": {},
"typeVersion": 1
},
{
"id": "85ff7b59-2c72-4846-953a-46ab1f50fee8",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
-240,
880
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MHVZRVo5aPs5VqRXk7lBNPVlZ2gilKqZ8J9yeg4taW4/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1MHVZRVo5aPs5VqRXk7lBNPVlZ2gilKqZ8J9yeg4taW4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MHVZRVo5aPs5VqRXk7lBNPVlZ2gilKqZ8J9yeg4taW4/edit?usp=drivesdk",
"cachedResultName": "Invoices"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "WsgMg14OYooIdvn7",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "e92eee15-18b1-4851-92ae-985d666b1857",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
320,
880
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineAll"
},
"typeVersion": 3.2
},
{
"id": "736b3314-daf7-4bd2-82e0-9e23018091b5",
"name": "获取发票模板",
"type": "n8n-nodes-base.googleDocs",
"position": [
100,
800
],
"parameters": {
"operation": "get",
"documentURL": "18n0HTqabDldi7fVbhbI1aG12qbFWsjyTXdduwDDOUu8"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "iOuZirVwbwI3E51t",
"name": "Google Docs account"
}
},
"typeVersion": 2
},
{
"id": "97b2ea4d-4904-49f5-bb1e-ae7e71156640",
"name": "创建新文档",
"type": "n8n-nodes-base.googleDocs",
"position": [
120,
980
],
"parameters": {
"title": "=Invoice: {{ $json.Invoice }}",
"folderId": "1TnDibwPPPUm3VbmETiqWDVhtaUTLJ6mn"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "iOuZirVwbwI3E51t",
"name": "Google Docs account"
}
},
"typeVersion": 2
},
{
"id": "86fb16bb-484b-44df-b4f5-25fde65a6c7f",
"name": "插入内容到文档",
"type": "n8n-nodes-base.googleDocs",
"position": [
600,
540
],
"parameters": {
"actionsUi": {
"actionFields": [
{
"text": "={{ $json.content }}",
"action": "insert"
}
]
},
"operation": "update",
"documentURL": "={{ $json.id }}"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "iOuZirVwbwI3E51t",
"name": "Google Docs account"
}
},
"typeVersion": 2
},
{
"id": "89810e9d-685e-4007-be83-0686ea779163",
"name": "输入发票详情",
"type": "n8n-nodes-base.googleDocs",
"position": [
800,
940
],
"parameters": {
"actionsUi": {
"actionFields": [
{
"text": "=FromCompany#",
"action": "replaceAll",
"replaceText": "={{ $('Google Sheets').item.json['Company From'] }}"
},
{
"text": "ToCompany#",
"action": "replaceAll",
"replaceText": "={{ $('Google Sheets').item.json['Company To'] }}"
},
{
"text": "Terms#",
"action": "replaceAll",
"replaceText": "={{ $('Google Sheets').item.json.Terms }}"
},
{
"text": "Invoice#",
"action": "replaceAll",
"replaceText": "={{ $('Google Sheets').item.json.Invoice }}"
},
{
"text": "Description#",
"action": "replaceAll",
"replaceText": "={{ $('Google Sheets').item.json.Description }}"
},
{
"text": "Amount#",
"action": "replaceAll",
"replaceText": "={{ $('Google Sheets').item.json.Amount }}\n"
}
]
},
"operation": "update",
"documentURL": "={{ $('Merge').item.json.id }}"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "iOuZirVwbwI3E51t",
"name": "Google Docs account"
}
},
"typeVersion": 2
},
{
"id": "d9d22f6b-bd25-4af5-b460-c76e9a9c527b",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-460,
-60
],
"parameters": {
"color": 3,
"width": 480,
"height": 1220,
"content": "### 步骤1:**手动触发器**"
},
"typeVersion": 1
},
{
"id": "ad368f70-57a1-4693-9763-d7d2b8980efe",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
40,
-60
],
"parameters": {
"color": 4,
"width": 460,
"height": 1220,
"content": "### ### 步骤3:`获取发票模板` — 加载Google文档"
},
"typeVersion": 1
},
{
"id": "a17e1690-a974-4552-88d2-5d87b89f5045",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
520,
-60
],
"parameters": {
"color": 5,
"width": 480,
"height": 1220,
"content": "### ### Step 7: `Input Invoice Details` — Replace Fields \nUses Google Docs API to replace all placeholders from the original template with the actual values.\n\n**Replacements:**\n\n| Placeholder | Replaced With |\n|----------------|------------------------------|\n| FromCompany# | `Company From` from sheet |\n| ToCompany# | `Company To` from sheet |\n| Terms# | `Terms` from sheet |\n| Invoice# | `Invoice` number |\n| Description# | `Description` of service |\n| Amount# | `Amount` of invoice |\n\n---\n\n## 📤 Final Output\n\nEach row from the Google Sheet results in a completed, branded Google Doc invoice stored in your Drive.\n\n---"
},
"typeVersion": 1
},
{
"id": "9a875848-3be3-4763-8c08-05c2db7d4601",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-460,
-180
],
"parameters": {
"width": 1460,
"height": 100,
"content": "## 💬 Need Help?\n📧 rbreen@ynteractive.com\n🔗 [LinkedIn](https://www.linkedin.com/in/robert-breen-29429625/)"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Merge": {
"main": [
[
{
"node": "Insert Content into Doc",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets": {
"main": [
[
{
"node": "Create New Doc",
"type": "main",
"index": 0
}
]
]
},
"Create New Doc": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Get Invoice Template": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Insert Content into Doc": {
"main": [
[
{
"node": "Input Invoice Details",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Get Invoice Template",
"type": "main",
"index": 0
},
{
"node": "Google Sheets",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 文档提取
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
在Google Sheets中使用自定义透视表和VLOOKUP聚合营销支出数据
在Google Sheets中使用自定义透视表和VLOOKUP聚合营销支出数据
Merge
Summarize
Google Sheets
+2
10 节点Robert Breen
文档提取
自动化营销绩效邮件报告
使用 Google Sheets 和 Outlook 自动生成营销绩效邮件报告
Merge
Summarize
Google Sheets
+3
13 节点Robert Breen
文档提取
初学者数据分析:使用 GPT-4o 在 Google Sheets 中合并、筛选和汇总
初学者数据分析:使用 GPT-4o 在 Google Sheets 中合并、筛选和汇总
If
Set
Code
+9
21 节点Robert Breen
文档提取
通过合并数据集使用Google Drive和Sheets创建多工作表Excel工作簿
通过合并数据集使用Google Drive和Sheets创建多工作表Excel工作簿
Code
Merge
Google Drive
+4
12 节点Robert Breen
文档提取
使用GPT-4洞察和PDF.co从Google Sheets生成营销报告
使用GPT-4洞察和PDF.co从Google Sheets生成营销报告
Code
Merge
Aggregate
+8
15 节点Robert Breen
文档提取
播客笔记记录器
使用GPT和Gemini结合性能数据创建高转化率Meta广告脚本
Set
Code
Merge
+7
24 节点Robert Breen
文档提取
工作流信息
难度等级
中级
节点数量11
分类1
节点类型5
作者
Robert Breen
@rbreenProfessional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.
外部链接
在 n8n.io 查看 →
分享此工作流