| name | dzg-invoice-skill |
| description | Convert Word/docx invoice evidence packages into item-grouped Excel workbooks, either by creating a new workbook or appending rows to an existing workbook. Use when the user asks to turn a .docx/Word file containing invoice screenshots, payment records, order pages, or product-detail screenshots into an Excel reimbursement/invoice ledger; triggers include Word转Excel, docx转Excel, 发票截图整理, 支付记录, 商品详情, 凭证台账, 追加到现有Excel, append invoice rows to Excel, invoice evidence to Excel, and DZG invoice/reimbursement workflows. |
DZG Invoice Skill
Goal
Create one Excel row per product, expense, order, or reimbursement item. Do not create one row per image unless the user explicitly asks for that.
The default sheet layout is:
日期 | 金额 | 品类 | 发票号 | 发票 | 支付记录 | 商品详情
Columns E-G contain the corresponding screenshots for that same row. If a screenshot type is missing, leave that cell blank. If one screenshot covers multiple related rows, reuse it in each matching row.
Workflow
- Locate the source
.docx and choose an output folder.
- Extract images and create a contact sheet:
& "<python>" "<skill>/scripts/docx_invoice_to_excel.py" "<source.docx>" --init-manifest "<work>/manifest.json"
- Inspect the contact sheet and extracted images. Identify which images are invoice screenshots, payment records, and product/order detail pages.
- Fill
manifest.json with one entry per item. Keep related images in the same row.
- Build the workbook:
& "<python>" "<skill>/scripts/docx_invoice_to_excel.py" "<source.docx>" --manifest "<work>/manifest.json" --output "<work>/发票凭证整理.xlsx"
- To append rows to an existing workbook, write to a new output path by default:
& "<python>" "<skill>/scripts/docx_invoice_to_excel.py" "<source.docx>" --manifest "<work>/manifest.json" --append-to "<work>/existing.xlsx" --output "<work>/existing_appended.xlsx"
Use --in-place only when the user explicitly wants to overwrite the existing workbook:
& "<python>" "<skill>/scripts/docx_invoice_to_excel.py" "<source.docx>" --manifest "<work>/manifest.json" --append-to "<work>/existing.xlsx" --in-place
Use the bundled Codex Python runtime when normal python is unavailable:
C:\Users\zhh\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe
Manifest
The script accepts this JSON shape:
{
"sheet_name": "按事项汇总",
"rows": [
{
"date": "2026-06-02",
"amount": 367.98,
"category": "移速U盘/移动固态硬盘",
"invoice_no": "26427000000455552779",
"invoice": ["image1.png"],
"payment": ["image4.png"],
"detail": ["image2.png"]
}
]
}
Image fields may be a string, an empty string, or a list. Lists are useful when several screenshots belong to the same item; the script stacks them into one cell image.
Matching Rules
- Group by the actual item/order/expense, not by filename order.
- Use invoice numbers only when visible on invoice screenshots.
- Use the payment screenshot date and amount only when it is clearly the same payment/order group.
- Reuse a shared payment screenshot when it explicitly covers multiple associated orders.
- Leave invoice, payment, or detail cells blank when the source lacks that screenshot type.
- Preserve the user's requested Chinese column names unless they asks for English output headers.
- In append mode, append below the last data row of the target sheet. If the target sheet has no headers, create the default headers first. If headers conflict, stop instead of appending into the wrong table.
Verification
After generation, reopen the workbook with openpyxl or Excel-compatible tooling and confirm:
- One main sheet exists.
- Headers are exactly the seven expected columns.
- Row count equals the number of grouped items, not image count.
- Embedded images are anchored only in E/F/G.
- Dates, amounts, categories, and invoice numbers are readable.
- The workbook opens without repair prompts.
- In append mode, the original row count plus appended row count equals the final row count, and pre-existing screenshots remain present.