XLSX conversion loses Excel error values such as #DIV/0! and #REF!
维护者通常 1 天内回复
@sunxiuguo 已经在做这个了。
开始于 2026年10月21日。
评估
调研方向
Start by tracing the built-in XLSX converter's pandas/openpyxl read path; the report shows the error value is lost during pandas' openpyxl cell conversion, before HTML or Markdown rendering. Use the reproduction in the issue to compare error-typed and text-typed cells and check the saved error tokens in the output. Done means each saved Excel error token is retained while a genuinely blank cell remains distinguishable; pull request #2732 is already open.
由索引模型根据 Issue 内容生成。
描述
The built-in XLSX converter replaces Excel error cells with NaN, losing which calculation failed. For example, #DIV/0!, #REF!, and #VALUE! all become indistinguishable from a blank cell. This affects saved error values; reproducing it does not require evaluating formulas.
Reproduced on current main at 69e208746aa5804087e9984d585eab21667e9b0f, using Python 3.12.15, pandas 3.0.6, openpyxl 3.1.5, and MarkItDown 0.1.8 on macOS:
import io
from openpyxl import Workbook, load_workbook
from markitdown import MarkItDown, StreamInfo
workbook = Workbook()
sheet = workbook.active
sheet.title = "Results"
sheet.append(["Case", "Result"])
sheet.append(["Valid value", 42])
for error in ("#DIV/0!", "#REF!", "#VALUE!", "#N/A", "#NUM!", "#NAME?", "#NULL!"):
sheet.append(["Error " + str(sheet.max_row), error])
sheet.append(["Blank", None])
source = io.BytesIO()
workbook.save(source)
workbook.close()
source.seek(0)
loaded = load_workbook(source, data_only=True)
assert loaded.active["B3"].value == "#DIV/0!"
assert loaded.active["B3"].data_type == "e"
loaded.close()
source.seek(0)
result = MarkItDown(enable_plugins=False).convert_stream(
source, stream_info=StreamInfo(extension=".xlsx")
)
print(result.markdown)
assert "#DIV/0!" in result.markdown
The assertion fails. Actual output:
## Results
| Case | Result |
| --- | --- |
| Valid value | 42.0 |
| Error 2 | NaN |
| Error 3 | NaN |
| Error 4 | NaN |
| Error 5 | NaN |
| Error 6 | NaN |
| Error 7 | NaN |
| Error 8 | NaN |
| Blank | NaN |
Expected: retain each saved error token in its corresponding cell, so readers can distinguish invalid references, division by zero, other errors, and missing data.
This is distinct from #2498 / #2499, which concern literal text recognized as missing. In a separate workbook containing an error-typed #DIV/0! cell and a text-typed #DIV/0! cell, pd.read_excel(..., dtype=object, keep_default_na=False) still returns NaN for the error cell while preserving the text cell. The error value is lost during pandas' openpyxl cell conversion, before HTML/Markdown rendering. No fix is included here.
- 主要语言
- Python
- 星标
- 198k
- 派生
- 15k
- 平均合并
- 2 小时 16 分钟
- 30 天内合并 PR
- 9
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/markitdown 的其他 Issue
-
IpynbConverter uses a comment inside a Markdown code fence as the notebook title可能已有人在做 @Primaverah 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
microsoft/markitdown#2964 · 1 条评论 ·
维护者通常 1 天内回复
-
PPTX image alt text ending in a backslash breaks the Markdown image可能已有人在做 @dongyikuan919 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/markitdown#2943 ·
维护者通常 1 天内回复
-
PPTX chart labels with pipes or line breaks produce malformed Markdown tables可能已有人在做 @dongyikuan919 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 92/100
microsoft/markitdown#2937 ·
维护者通常 1 天内回复
-
DOCX: math pre-processing re-parses every document.xml even without equations (32 s -> 17.5 s on a 12.5 MB document)可能已有人在做 @houyunsun 于 26 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 89/100
microsoft/markitdown#2834 ·
维护者通常 1 天内回复
-
URL fetch sends default python-requests User-Agent, Wikipedia returns 403可能已有人在做 @sushan5140 于 31 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
microsoft/markitdown#2820 ·
维护者通常 1 天内回复
查看 microsoft/markitdown 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
hugohe3/ppt-master#366 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 89/100
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
521xueweihan/HelloGitHub#4716 ·
-
难度 1/5 1 小时以内 新手友好度 84/100
pcqpcq/open-source-android-apps#619 ·
维护者通常 1 天内回复
-
contribution Windows 主机
难度 2/5 1-3 小时 新手友好度 72/100
Lee-xeo/Claude-Cage#1519 ·
维护者通常 1 天内回复