办公任务
在 Duaer 里批量把 PDF 发票提取成 Excel 表
在 Duaer 里上传一批 PDF 发票,读出文字,用 Basic LLM Chain 和 Duaer Chat Model 取出供应商、金额、税号和日期,最后导出一张 Excel。
在 Duaer 里搭发票提取流程
- 新建工作流程,加 Form Trigger。加一个字段,标签写 Invoices,Element Type 选 File,打开 Multiple Files,Accepted File Types 写 .pdf。
- 接一个 Code 节点,改名为 Split files,粘贴下面的代码。它把一次上传的多个 PDF 拆成一条一张,文件都放在 data 上。
- 接 Extract from File,Operation 选 Extract From PDF,Input Binary Field 填 data。每张发票的文字在 text 字段里。
- 接 Basic LLM Chain,Chat Model 挂 Duaer Chat Model,在 Model 里选一个模型。Source for Prompt (User Message) 选 Define below,Prompt (User Message) 写:从下面的发票文字里取出各字段。找不到的填 unknown,不要编数字。日期写成 YYYY-MM-DD。发票文字:{{ $json.text }}
- 在 Basic LLM Chain 上打开 Require Specific Output Format,Output Parser 挂 Structured Output Parser,Schema Type 选 Generate From JSON Example,JSON Example 粘贴下一节的示例。每张发票的字段在 output 里。
- Basic LLM Chain 只输出 output。接 Merge:Input 1 连 Split files,Input 2 连 Basic LLM Chain,Mode 选 Combine,Combine By 选 Position。
- 接 Edit Fields,Mode 选 JSON,填 {{ { ...$json.output, file: $json.fileName } }}。每条就是一张发票,file 是来源文件名。
- 接 Convert to File,Operation 选 Convert to XLSX。所有发票合成一张表,放在 binary.data 上。
const out = [];
for (const item of $input.all()) {
for (const key of Object.keys(item.binary ?? {})) {
out.push({
json: { ...item.json, fileName: item.binary[key].fileName },
binary: { data: item.binary[key] },
});
}
}
return out;Duaer 发票表里有哪些列
- vendor:发票上的公司名。
- amount:金额,数字字符串;currency:币种。
- tax_id、invoice_number、invoice_date(YYYY-MM-DD)。
- file:来源 PDF 的文件名。
{
"vendor": "Acme Trading Co.",
"amount": "1280.00",
"currency": "CNY",
"tax_id": "91310000MA1FL0000X",
"invoice_number": "12345678",
"invoice_date": "2026-09-30"
}发票上找不到的项填 unknown。模型也会出错,导出后抽查几张金额和税号。
每张发票调用一次 Duaer Chat Model,按所选模型的价格扣 AI 积分,见 Duaer 套餐与积分。读 PDF 和导出 Excel 不扣积分。
把 Excel 发出去
在 Duaer 画布上,Convert to File 的输出里可以直接下载 xlsx。要每次自动送到别处,在后面接 Send Email 把 data 作为附件,或用 Google Drive 上传。
常见问题
Duaer 能处理扫描版的 PDF 发票吗?
Duaer 的 Extract From PDF 只读 PDF 里的文字层。扫描件或照片没有文字层,text 会是空的,需要先做 OCR,再把文字交给 Basic LLM Chain。
在 Duaer 里提取一张发票要多少钱?
一张发票调用一次 Duaer Chat Model,按所选模型的价格扣 AI 积分,价格写在 Model 下拉框里。读 PDF 和导出 Excel 不扣积分。
同组
在 Duaer Chat Model 里选模型
在 Duaer 里,Duaer Chat Model 给 AI Agent 或 Basic LLM Chain 接上模型。模型由配置节点的人在下拉框里选,每个模型标着自己的积分价格。
节点在 Duaer 里用 Extract from File 读出文件
在 Duaer 里,Extract from File 从 binary 上的文件读出 JSON 条目或文本。默认 Operation 是 Extract From CSV。
节点在 Duaer 里用 Convert to File 写出文件
在 Duaer 里,Convert to File 把当前条目的 JSON 转成 binary 上的文件。默认 Operation 是 Convert to CSV。
办公任务在 Duaer 里把多个 Excel 表合并成一张
在 Duaer 里一次上传多个 xlsx,逐个读出行,加上来源文件名,去重后导出一张汇总表。不用写公式,也不扣 AI 积分。