Skip to main content

Excel-declared data extraction powered by Pandas

Project description

ExcelFlow

一个由 Excel 声明驱动、使用 Pandas 执行的数据抽取工具。Excel 管理抽取任务、Sheet 关联、过滤和字段映射。

快速开始

uv run excelflow template extraction_plan.xlsx
uv run excelflow validate extraction_plan.xlsx
uv run excelflow preview extraction_plan.xlsx demo_orders
uv run excelflow run extraction_plan.xlsx demo_orders ./data/source.xlsx csv ./output/orders.csv

也可以通过模块入口运行:

uv run python -m excelflow validate extraction_plan.xlsx

生成的工作簿包含:

  • 抽取计划:一行一个任务,仅管理任务ID、启用状态和备注。
  • 字段映射:选择、重命名和转换字段;不填写时保留全部字段。
  • 过滤条件:一行一个条件;同组内使用 AND,不同组之间使用 OR。
  • 数据对象:声明任务使用的 Sheet、对象别名和唯一主表。
  • 关联关系:配置 Sheet 之间的 INNER JOINLEFT JOIN
  • 填写说明:字段语义和操作流程。

仅支持 Excel 数据源,输出支持 CSV、JSONL、XLSX。源 Excel 文件在执行 run 时传入,计划文件本身不保存数据源路径。一个任务可以声明同一源 Excel 中的多个 Sheet,并通过对象别名关联查询。

源工作表由 Pandas 加载到内存中,通过 merge、布尔掩码和 Series 运算完成关联、过滤和字段转换。

过滤运算符支持 =!=>>=<<=INNOT INBETWEENLIKENOT LIKEIS NULLIS NOT NULL

字段映射和过滤条件使用 对象别名.字段 格式。每个任务必须且只能有一个主表;相同“关联顺序”的多条关联记录会组合为多个 AND 条件。

安全边界

转换表达式通过受限 AST 解释器执行,不使用 Python eval()。目前只允许字段引用、常量、四则运算、取模以及 coalesceabsroundclip

项目结构

采用标准 src/excelflow 布局。repository 读取计划,validator 校验声明,engine 实现 Pandas 执行策略,expression 负责安全衍生列,output 提供输出策略,service 编排完整流程,cli 只处理命令行交互。

教学示例

examples/README.md 提供从单 Sheet 抽取、条件过滤、Sheet 关联到复合关联键和衍生列的四课递进教程。示例计划和源数据已生成,可以直接运行。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

excelflow-0.1.0.tar.gz (67.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

excelflow-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file excelflow-0.1.0.tar.gz.

File metadata

  • Download URL: excelflow-0.1.0.tar.gz
  • Upload date:
  • Size: 67.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for excelflow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2c09d6e21c4059f925e417a41e1fbe1e10502cccb855cf9c5c3ec0f80c1b1fe5
MD5 75a351eb3a9ece56f245458f665c7f3a
BLAKE2b-256 0b0b4ff70184a41f5bfa7f9fa08fd62d96fbf8137ad3eb6bf874b08f1cf34625

See more details on using hashes here.

File details

Details for the file excelflow-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: excelflow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for excelflow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e8fd64caca2cfe6d621f764dbd5fb7fe01853d553982ae6da0013a4089267b5
MD5 065f4cc83f66a5b6f8b5ef67e6db66a2
BLAKE2b-256 941f15387d0d4e6613471438c5a9d8a4f252654c76cb94d1a04a61d9b6d8537d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page