Skip to content

XLSX/XLS: whole numbers render as "1.0" when the column contains a blank cell #2484

Description

Description

In XLSX/XLS conversion, a single blank cell forces pandas to read its column as float64, so every whole number in that column renders with a .0 suffix, inconsistent with clean columns beside it:

# sheet: A1='count', A2=1, A3 blank, A4=2
from markitdown import MarkItDown, StreamInfo
...
'| count |',
'| 1.0 |',
'| NaN |',
'| 2.0 |',

Expected the integer rendering of clean columns: 1, 2.

Reproduction

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

wb = Workbook(); ws = wb.active
ws['A1'] = 'count'; ws['A2'] = 1; ws['A3'] = None; ws['A4'] = 2
buf = io.BytesIO(); wb.save(buf); buf.seek(0)
print(MarkItDown().convert_stream(buf, stream_info=StreamInfo(extension='.xlsx')).markdown)

No network or fixture needed.

Notes

Distinct from the NaN-noise discussion in #2124 / #2286: simulating their patch still renders 1.0 for a numeric-header/data-only sheet, so the float64 promotion is a separate defect.

Environment

markitdown main (cc0ca9e), Python 3.12

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