> For the complete documentation index, see [llms.txt](https://doc.duaer.com/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/tasks/pdf-invoices-to-excel.md).

# 在 Duaer 里批量把 PDF 发票提取成 Excel 表

在 Duaer 里上传一批 PDF 发票，读出文字，交给发票抽取员工拿到供应商、金额、税号和日期，最后导出一张 Excel。
## 在 Duaer 里搭发票提取流程

1. 雇佣发票抽取员工：打开 [Duaer 发票抽取员工](https://hire.duaer.com/zh/invoice-extract/)，登录后在员工市场雇佣，在「已雇佣」里点「复制 ID」。
2. 新建数字组织，加 [Form Trigger](/zh/build/form-trigger.md)。加一个字段，标签写 Invoices，Element Type 选 File，打开 Multiple Files，Accepted File Types 写 .pdf。
3. 接一个 [Code](/zh/build/code.md) 节点，改名为 Split files，粘贴下面的代码。它把一次上传的多个 PDF 拆成一条一张，文件都放在 data 上。
4. 接 [Extract from File](/zh/build/extract-from-file.md)，Operation 选 Extract From PDF，Input Binary Field 填 data。每张发票的文字在 text 字段里。
5. 接 [Duaer Employee](/zh/build/duaer-employee.md)，Position ID 粘贴刚复制的 ID，Input 填 {{ $json.text }}。
6. 接 [Edit Fields](/zh/build/edit-fields.md)，打开 Include Other Input Fields，加一个字段 file，值是 {{ $('Split files').item.json.fileName }}，表里就能看出每行来自哪个文件。
7. 接 [Convert to File](/zh/build/convert-to-file.md)，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 的文件名。

发票上找不到的项填 unknown，员工不编数字。每张发票按员工价格扣 8 积分，见 [Duaer 套餐与积分](/zh/manage-cloud/plans.md)。

## 把 Excel 发出去

在 Duaer 画布上，Convert to File 的输出里可以直接下载 xlsx。要每次自动送到别处，在后面接 [Send Email](/zh/build/send-email.md) 把 data 作为附件，或用 [Google Drive](/zh/build/google-drive.md) 上传。

## Duaer 在线工具

- [PDF 表格转 Excel 在线转换（可复制文字的 PDF）](https://doc.duaer.com/zh/tools/pdf-table-to-excel.md)
## Questions

### Duaer 能处理扫描版的 PDF 发票吗？

Duaer 的 Extract From PDF 只读 PDF 里的文字层。扫描件或照片没有文字层，text 会是空的，需要先做 OCR，再把文字交给发票抽取员工。

### 在 Duaer 里提取一张发票要多少钱？

Duaer 发票抽取员工每次成功调用扣 8 积分，一张发票调用一次；读 PDF 和导出 Excel 不扣积分。

## 相关

- [用 Duaer Employee 调用雇佣的员工](https://doc.duaer.com/zh/build/duaer-employee.md)
- [在 Duaer 里用 Extract from File 读出文件](https://doc.duaer.com/zh/build/extract-from-file.md)
- [在 Duaer 里用 Convert to File 写出文件](https://doc.duaer.com/zh/build/convert-to-file.md)
- [在 Duaer 里把多个 Excel 表合并成一张](https://doc.duaer.com/zh/tasks/merge-excel-files.md)

