microsoft / microsoft/markitdown
XLSX/XLS: float values rendered in 6-digit scientific notation, entered digits are dropped
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.123becomes1.234568e+08(the fractional part is gone)0.1becomes1.000000e-0142in a float column becomes4.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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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