XLSX conversion loses Excel error values such as #DIV/0! and #REF!

Aperta
#2,728 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@sunxiuguo ci sta già lavorando.

Dal 21/10/2026.

  • #2732 di @sunxiuguo — aperta
  • #2766 di @dpka2206 — aperta
  • #2869 di @wangkangmao — aperta
  • #2898 di @poojithparchuri-iiitk — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
pandas, python
Ambito
backend, data

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
198k
Fork
15k
Merge medio
2h 16m
PR unite (30g)
9

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/markitdown

Tutte le issue di microsoft/markitdown

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.