markitdown icon indicating copy to clipboard operation
markitdown copied to clipboard

XLSX/XLS: float values rendered in 6-digit scientific notation, entered digits are dropped

Open ManoharPaturi opened this issue 2 months ago • 0 comments

Description

XLSX/XLS conversion renders spreadsheet float values through pandas' to_html default, which formats floats with 6 significant digits in scientific notation. Entered values lose digits:

  • 123456789.123 becomes 1.234568e+08 (the fractional part is gone)
  • 0.1 becomes 1.000000e-01
  • 42 in a float column becomes 4.200000e+01

Distinct from #53 (currency display formatting) and #2516 (blank-cell column upcasting): this happens in a clean all-float column with no blanks and no currency formats; the raw stored value itself is what gets mangled.

Reproduction

import io
from openpyxl import Workbook
from markitdown import MarkItDown, StreamInfo

wb = Workbook(); ws = wb.active
ws["A1"] = "money"; ws["A2"] = 123456789.123; ws["A3"] = 0.1
buf = io.BytesIO(); wb.save(buf); buf.seek(0)
print(MarkItDown().convert_stream(buf, stream_info=StreamInfo(extension=".xlsx")).markdown)

Expected behavior

The shortest string that round-trips the stored value: 123456789.123, 0.1, 1e-10.

Environment

markitdown main (945314a)

ManoharPaturi avatar Sep 18 '26 12:09 ManoharPaturi