shdskill22

Automatically extract invoice numbers from OFD-format electronic invoices, support bulk upload, and output Excel detail sheets to facilitate subsequent duplicate checking, statistics and management.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "shdskill22" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-abc32bca7444ee102fa63a03ab8ade22bff21ea51310153f82cddeee7b4b823b. Verify the upstream source and version against https://skillhub.cn/skills/user_9355e276/shdskill22 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Automatically extract invoice numbers from OFD-format electronic invoices, support bulk upload, and output Excel detail sheets to facilitate subsequent duplicate checking, statistics and management.

0 Downloads

Introduction source: third_party · user_9355e276 · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Software, accounts and paid services
Translation pending; see source documentation.
Limits and differences
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: shdskill22
description: 从OFD格式电子发票中自动提取发票号码,支持批量上传,输出为Excel明细表,方便后续查重、统计和管理。

OFD电子发票号码提取器

功能概述

本技能专门用于解析 OFD(Open Fixed-layout Document)格式的电子发票,自动提取发票号码及关键信息并生成 Excel 文件:

  • 多类型支持:增值税电子普通发票、增值税电子专用发票、全电发票(数电票)
  • 批量处理:支持单次最多 200 个 OFD 文件批量提取
  • 全字段提取:发票号码、发票代码、开票日期、金额、税额、价税合计、购销方名称及税号
  • 自动查重:自动识别重复发票号码并单独标记
  • Excel 导出:生成包含「发票明细」「统计信息」「失败列表」「重复列表」多 Sheet 的 Excel 报表
  • 标准解析:基于 OFD 国标(GB/T 33190)结构,通过 CustomTag 语义标签 + ObjectRef + TextObject 链路精准提取

触发指令

  • "提取OFD电子发票"
  • "OFD电子发票提取"
  • "提取OFD"
  • "OFD发票解析"
  • "读取OFD发票"
  • "OFD发票号码提取"

依赖环境

  • Python 3.10+
  • pandas
  • openpyxl
  • tkinter(Python 内置 GUI 库,随 Python 安装)

工作流程

阶段一:上传文件(弹窗界面)

当用户触发技能后,PC 端弹出 tkinter 操作弹窗:

  1. 点击「添加文件」选择单个或多个 .ofd 文件
  2. 或点击「添加文件夹」批量导入某文件夹下所有 OFD 文件(最多 200 个)
  3. 可点击「清空列表」重新选择
  4. 确认后点击「确定」开始提取

阶段二:自动解析提取

程序按 OFD 标准结构解析每个文件:

  1. 解压 OFD(ZIP 格式)
  2. 读取 Document.xml 获取文档结构
  3. 定位 CustomTags.xml -> CustomTag.xml 语义标签文件
  4. 解析 InvoiceNo、IssueDate、BuyerName、SellerName、TaxExclusiveTotalAmount 等字段
  5. 通过 ObjectRef -> PageRef -> Content.xml -> TextObject -> TextCode 链路提取实际文本
  6. 支持多 ObjectRef 拼接(如金额拆分为货币符号 + 数字两个对象)
  7. 自动过滤货币符号(¥/¥)、逗号、空格等无关字符

阶段三:导出结果

提取完成后自动生成 Excel 文件保存到桌面:

  • 发票明细 Sheet:序号、发票号码、发票代码、开票日期、金额、税额、价税合计、购销方名称及税号、文件名称、提取时间
  • 统计信息 Sheet:总文件数、成功提取数、失败数、重复数
  • 失败列表 Sheet:失败文件路径及失败原因(如有)
  • 重复列表 Sheet:重复发票号码(如有)

文件名格式:OFD发票号码提取结果_YYYYMMDD_HHMMSS.xlsx

技术细节

OFD 解析原理

OFD 文件本质是 ZIP 压缩包,内部采用 XML 描述文档结构和内容。发票语义数据存储在 Doc_X/Tags/CustomTag.xml 中,其中每个字段标签(如 InvoiceNo)不直接包含文本值,而是通过 ObjectRef 引用页面内容中的 TextObject ID。程序需要:

  1. 从 Document.xml 获取 CustomTags 路径和页面映射
  2. 解析 CustomTag.xml 获取字段标签及其 ObjectRef 引用
  3. 通过 PageRef 定位到对应页面的 Content.xml
  4. 在 Content.xml 中根据 TextObject ID 找到 TextCode 获取实际文本

回退机制

如果标准 CustomTag 解析未找到发票号码,程序会回退到通用 XML 标签搜索模式,遍历所有 XML 文件,查找 InvoiceNumber、发票号码、InvoiceNo 等标签,并支持正则匹配 20 位数字。

使用示例

用户:提取OFD电子发票
WorkBuddy:[弹出文件选择窗口]
用户:[选择 3 个 .ofd 文件,点击确定]
WorkBuddy:✅ 提取完成!成功 3 个,失败 0 个
          发票号码:26372000003529013986
          发票号码:26372000003529013987
          发票号码:26372000003529013988
          Excel 文件已保存到桌面

注意事项

  • 仅支持 .ofd 格式文件,不支持 PDF 发票
  • 单文件大小限制 20MB
  • 程序在本地运行,不上传任何发票数据到服务器
  • 需要安装 Python 运行环境及 pandas、openpyxl 依赖

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 解决财务人员批量处理OFD电子发票的实际痛点
  • 支持多种发票类型和批量处理,功能闭环完整
  • 基于OFD国标解析,技术实现专业可靠
Trigger Precision95/100

Highlights

  • 触发词覆盖全面,包含多种常见表达变体
  • 边界清晰,明确限定OFD格式不包含其他格式
Structure and Standards90/100

Highlights

  • Phase划分清晰,有明确出口条件和端到端示例
  • 文档结构完整,包含功能概述、技术细节和使用示例
Execution Reliability88/100

Highlights

  • 工具来源明确,参数说明清晰
  • 异常处理完善,包含失败列表和重复标记
  • 回退机制健全,本地运行保障数据安全
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Translation pending; see source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.