Skip to content

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

Description

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions