microsoft / microsoft/markitdown

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

Open
#2,532 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
186k
Forks
13.7k
Avg merge
1d 4h
Merged PRs (30d)
49

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the XLSX/XLS conversion path and inspect where pandas' to_html formats float values. Run the provided openpyxl reproduction to observe the current markdown output. Done means stored values render as the shortest strings that round-trip them, including 123456789.123, 0.1, and 1e-10.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.