新增大 Excel 轻量级解析路径,解决大表格 OOM
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 230
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
描述
处理超大 Excel(如 33MB XML sheet、74 万单元格)时,openpyxl 全量加载创建百万级 Cell 对象,内存占用超过 12GB,进程被 OOM 杀死。本 PR 新增轻量级解析路径(SAX 流式解析),内存峰值从 12GB+ 降至 2.2GB。
根因
load_workbook() 为每个单元格(含空位)创建 Cell 对象 -> 百万级对象 -> 12GB
异常文件含 18 万行合并区域(18.6 万个),拉大洪水填充边界
_find_true_data_bounds 将合并区域纳入边界,max_row=186365,洪水填充遍历 74 万空单元格
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating load_workbook() and _find_true_data_bounds, then trace how merged ranges affect the worksheet bounds and cell creation. Reproduce the large-sheet case described in the issue and compare the existing path with the proposed SAX streaming path. Done means large Excel files can be parsed without the current 12GB+ memory failure and with the stated lower peak usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100