Formats

Converting Excel workbooks to Markdown with MarkItDown

Updated 2026-11-15·Upstream source ↗
Markdown view

MarkItDown turns every sheet into one Markdown table, reading the workbook the way a data library would, not the way Excel displays it. That is why blanks become NaN and percentages become decimals. We built 17 test workbooks, one per behaviour, and recorded what each one produced on version 0.1.9.

Short answer

Install the extra (xlsx, plus xls for old .xls files), convert, save with -o:

Command
markitdown workbook.xlsx -o workbook.md

One table per sheet, values not formulas, no formatting, blanks as NaN. Clean it with the recipe below.

Tested with markitdown 0.1.9 · Python 3.13 · markitdown[all] 0.1.9 · Linux lab (LibreOffice 24.2 for recalculation and legacy formats); the sample workbooks also ran on Windows, macOS and Ubuntu runners (T05) · 2026-11-15 · evidence: office-features.csv, xlsx-number-formats.csv, xlsx-scale.csv, xlsx-features.jsonl

What a workbook becomes

Our three-sheet sample workbook:

markitdown workbook.xlsx
## Rainfall
| Station | Date | Rainfall (mm) | Cost | Share |
| --- | --- | --- | --- | --- |
| Alpha | 2026-03-01 | 412.5 | 1200.50 | 0.33 |
| Bravo | 2026-03-02 | 388.0 | 980.00 | 0.31 |
| Charlie | 2026-03-03 | 451.3 | 1410.25 | 0.36 |
| NaN | NaT | NaN | NaN | NaN |
| Total | NaT | 1251.8 | 3590.75 | NaN |

## Notes
| Merged header across three columns | Unnamed: 1 | Unnamed: 2 |
| --- | --- | --- |
| Key | Value | Comment |
| battery | low | NaN |
| NaN | NaN | NaN |
| sensor | new | pipe | inside |

## Empty
|
|  |
synthetic_workbook.xlsx.md · 526 bytes output (.md)

Look for: one ## SheetName heading per sheet; the first row used as the header; NaN and NaT for blank cells; Unnamed: 1 for blank header cells; decimals where Excel showed a percentage or currency; and an empty sheet that still produces a heading and a stray empty table.

Feature by feature

17 spreadsheet behaviours, one test workbook each, markitdown 0.1.9
BehaviourResultWhat came outNote
Several sheetskept## Rainfall↵| Station | mm |↵| --- | --- |↵| Alpha | 412.5 |↵↵## Notes↵| Key | Value |↵| --- | --- |↵| battery | low |One ## heading per sheet.
Empty sheetchanged## Data↵| A | B |↵| --- | --- |↵| 1 | 2 |↵↵## EmptySheet↵|↵| |↵↵## HiddenSheet↵| secret |↵| --- |↵| hidden value |An empty sheet produces a heading with an empty table.
Hidden sheetchanged## HiddenSheet↵| secret |↵| --- |↵| hidden value |Hidden sheets are included in the output.
Hidden rows and columnschanged## Sheet↵| A | B | C |↵| --- | --- | --- |↵| 1 | 2 | 3 |↵| hiddenrow | x | y |Hidden rows and columns are included.
Formulas without cached resultslost## Sheet↵| x | double |↵| --- | --- |↵| 2 | NaN |↵| 3 | NaN |↵| total | NaN |Formula cells come out as NaN: the formula text is never output.
Formulas after re-saving through LibreOfficekept## Sheet↵| x | double |↵| --- | --- |↵| 2 | 4 |↵| 3 | 6 |↵| total | 10 |Results are present after a recalculation pass.
Number formats (see table below)changed## Sheet↵| Case | Value shown in Excel |↵| --- | --- |↵| date | 2026-03-01 00:00:00 |↵| datetime | 2026-03-01 14:30:00 |↵| time | 09:15:00 |↵| currency | 1200.5 |↵| percent | 0.331 |↵| thousands | 1234567 |↵| zip code as text | 01Excel's display formats are not applied.
Merged header cellschanged## Sheet↵| Merged header across three columns | Unnamed: 1 | Unnamed: 2 |↵| --- | --- | --- |↵| Key | Value | Comment |↵| battery | low | NaN |Merged cells give Unnamed columns; the real header becomes the first data row.
Header on row 3 or belowchanged## Sheet↵| Report title | Unnamed: 1 |↵| --- | --- |↵| Generated 2026-03-01 | NaN |↵| NaN | NaN |↵| Station | mm |↵| Alpha | 412.5 |The first row is used as the header, so the real header becomes data.
Blank spacer rows and columnschanged## Sheet↵| A | Unnamed: 1 | C |↵| --- | --- | --- |↵| 1.0 | NaN | 3.0 |↵| NaN | NaN | NaN |↵| 4.0 | NaN | 6.0 |Blanks become NaN and Unnamed columns; the table is not split.
A pipe and a line break inside cellschanged## Sheet↵| k | v |↵| --- | --- |↵| state | OK | stable |↵| note | line one\nline two |A pipe is NOT escaped, so the row gets an extra cell; a line break inside a cell comes out as the two characters \n.
Wide sheet (60 columns)kept## Sheet↵| col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | col9 | col10 | col11 | col12 | col13 | col14 | col15 | col16 | col17 | col18 | col19 | col20 | col21 | col22 | col23 | col24 | col25 | col26 | col27 | col28 | col2One very long table row; readable by a model, not by a person.
Chart, picture and cell notelost## Sheet↵| Quarter | Revenue |↵| --- | --- |↵| Q1 | 10 |↵| Q2 | 14 |↵| Q3 | 9 |Only the cell values are output; chart, picture and note are ignored.
Integers next to a blank cellchanged## Sheet↵| id | count |↵| --- | --- |↵| 1 | 5.0 |↵| 2 | NaN |↵| 3 | 7.0 |A column with a blank is read as floating point, so 5 prints as 5.0.
.xls (legacy workbook)kept## Rainfall↵| Station | mm |↵| --- | --- |↵| Alpha | 412.5 |↵↵## Notes↵| Key | Value |↵| --- | --- |↵| battery | low |Handled by the xls extra; the output matches the .xlsx.
.xlsm (macro-enabled extension)kept## Rainfall↵| Station | mm |↵| --- | --- |↵| Alpha | 412.5 |↵↵## Notes↵| Key | Value |↵| --- | --- |↵| battery | low |Accepted only if the extension is recognised; see the output.
.ods (OpenDocument spreadsheet): directly and through LibreOfficekeptdirectly: UnsupportedFormatException: Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filet | via .xlsx: ## Rainfall↵| Station | mm |↵| --- | --- |↵| Alpha | 412.5 |↵↵## Notes↵| Key | Value |↵| --- | --- |Directly: refused. Through LibreOffice to .xlsx: identical to converting the original.
.ods (OpenDocument spreadsheet)lostUnsupportedFormatException: Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.No converter for .ods.
17 spreadsheet behaviours, one test workbook each, markitdown 0.1.9 Source: Test T07 · Linux lab · 2026-11-15 · office-features.csv · Download CSV

Why you see NaN, NaT and Unnamed

Where they come from

The sheet is loaded as a data frame (pandas) and written out as a table. Missing numbers are NaN, missing dates are NaT and missing header cells are named Unnamed: n. MarkItDown 0.1.9 has no option to change that.

Integers that turn into decimals

A column with a blank cell is read as floating point, so 5 prints as 5.0 and the blank as NaN:

An integer column with a blank
## Sheet
| id | count |
| --- | --- |
| 1 | 5.0 |
| 2 | NaN |
| 3 | 7.0 |
xlsx-X17.md · 73 bytes output (.md)

The clean-up recipe

Post-process the output: blank NaN/NaT, blank the Unnamed headers and drop rows that are completely empty. It cannot tell a literal cell containing the text "NaN" from a missing one, so do not use it on data where that matters.

Pythonapi-xlsx-clean.py
import re
from markitdown import MarkItDown

def clean(markdown: str) -> str:
    """Blank NaN/NaT cells, rename 'Unnamed: n' headers to nothing, drop rows that are completely empty."""
    out = []
    for line in markdown.splitlines():
        if line.startswith("|") and not line.startswith("| ---"):
            cells = [c.strip() for c in line.strip().strip("|").split(" | ")]
            cells = ["" if c in ("NaN", "NaT") or re.fullmatch(r"Unnamed: \d+", c) else c for c in cells]
            if not any(cells):
                continue
            line = "| " + " | ".join(cells) + " |"
        out.append(line)
    return "\n".join(out)

raw = MarkItDown().convert("samples/xlsx-blank-rows-cols.xlsx").markdown
print("BEFORE\n" + raw)
print("AFTER\n" + clean(raw))
Output · markitdown 0.1.9 · Python 3.13.18 · 2026-11-15
BEFORE
## Sheet
| A | Unnamed: 1 | C |
| --- | --- | --- |
| 1.0 | NaN | 3.0 |
| NaN | NaN | NaN |
| 4.0 | NaN | 6.0 |
AFTER
## Sheet
| A |  | C |
| --- | --- | --- |
| 1.0 |  | 3.0 |
| 4.0 |  | 6.0 |

captured result

The alternative: read the sheet yourself

When you control the code, loading the sheet yourself is cleaner than repairing the output. This is outside MarkItDown; it needs pandas and tabulate.

Pythonapi-xlsx-pandas.py
import pandas as pd

# when you control the code, read the sheet yourself: choose the header row, keep blanks as empty strings, then write the table
df = pd.read_excel("samples/xlsx-header-row3.xlsx", header=3, dtype=str).fillna("")
print(df.to_markdown(index=False))
Output · markitdown 0.1.9 · Python 3.13.18 · 2026-11-15
| Station   |    mm |
|:----------|------:|
| Alpha     | 412.5 |

captured result

Formulas: you get the last calculated value, or nothing

A workbook saved by Excel carries a cached result for each formula, and MarkItDown outputs that value, never the formula text. A workbook written by a script and never opened in Excel has no cached results, and every formula cell comes out as NaN:

Formulas never calculated
## Sheet
| x | double |
| --- | --- |
| 2 | NaN |
| 3 | NaN |
| total | NaN |
xlsx-X05.md · 77 bytes output (.md)

The tested fix is to recalculate and re-save through LibreOffice in headless mode, then convert; the same file then gave 4, 6 and 10:

After recalculation in LibreOffice
## Sheet
| x | double |
| --- | --- |
| 2 | 4 |
| 3 | 6 |
| total | 10 |
xlsx-X06.md · 72 bytes output (.md)

Error values such as #DIV/0! come out as NaN.

Dates, currency, percentages and other number formats

Excel's display formats are not applied. This is what each case produced (the workbook had been saved by LibreOffice so that the values were cached):

What Excel shows against what MarkItDown outputs
CaseShown in ExcelMarkItDown outputVerdict
date01/03/2026 (format dd/mm/yyyy)2026-03-01 00:00:00Changed: ISO date with a 00:00:00 time
datetime2026-03-01 14:302026-03-01 14:30:00Changed: seconds added
time09:1509:15:00Changed: seconds added
currency$1,200.501200.5Lost: symbol and separators
percent33.1%0.331Lost: becomes the fraction 0.331
thousands1,234,5671234567Lost: separators
zip code as text0123401234Kept: text keeps its zero
zip code as number with leading zero format01234 (format 00000)1234Lost: the leading zero (1234)
scientific1.23E-040.000123Lost: plain decimal
very long number1234567890123456789012345678901234599936Changed: precision lost (…4599936)
booleanTRUETrueChanged: True
error value#DIV/0!NaNLost: NaN instead of the error
What Excel shows against what MarkItDown outputs Source: Test T07 · 2026-11-15 · xlsx-number-formats.csv · Download CSV

The dangerous ones are the leading zero (01234 stored as a number with a display format becomes 1234: store codes as text) and the very long number, which lost precision.

Layouts that confuse the table

  • Merged header cells: the merged title becomes the header and the real header becomes the first row.
A merged header
## Sheet
| Merged header across three columns | Unnamed: 1 | Unnamed: 2 |
| --- | --- | --- |
| Key | Value | Comment |
| battery | low | NaN |
xlsx-X08.md · 143 bytes output (.md)
  • Header not on the first row: title rows above the table become the header. Mitigation: read the sheet yourself with the right header row (above).
Two title rows above the table
## Sheet
| Report title | Unnamed: 1 |
| --- | --- |
| Generated 2026-03-01 | NaN |
| NaN | NaN |
| Station | mm |
| Alpha | 412.5 |
xlsx-X09.md · 132 bytes output (.md)
  • Blank rows and columns: they stay inside the table as NaN and Unnamed columns; the table is not split. The recipe above removes them.
  • A | inside a cell is not escaped and adds a column; a line break inside a cell comes out as the two characters \n.
A pipe and a line break in cells
## Sheet
| k | v |
| --- | --- |
| state | OK | stable |
| note | line one\nline two |
xlsx-X11.md · 86 bytes output (.md)
  • Wide sheets: 60 columns gave one very long row, which a model can read and a person cannot.
  • Hidden sheets, rows and columns are included. A sheet with state=hidden appeared in the output with its data.
  • An empty sheet produces a heading and a stray empty table.

Charts, pictures, comments and pivot tables

Only cell values are output. A bar chart, a picture and a cell note on one sheet all disappeared from the output (unlike PowerPoint, where charts become tables: PowerPoint page). Pictures are covered on the image page. We did not test pivot tables.

.xls, .xlsm, .xlsb and .ods

  • .xls needs the xls extra and gave the same output as .xlsx for our workbook.
  • .xlsm (an .xlsx renamed, with no macros inside) was accepted. We did not test a file that really contains macros; macros are never run.
  • .ods raised UnsupportedFormatException: no converter.
  • .xlsb: we did not test it.
An .ods workbook
UnsupportedFormatException: Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.
xlsx-X15.md · 156 bytes output (.md)

Big workbooks: time, memory and output size

Workbooks of 10 columns and 1,000 to 100,000 rows on our lab machine:

Time, peak memory and output size by workbook size
RowsFile (MB)SecondsPeak memory (MB)Output (characters)Tokens
10000.050.81786596334389
100000.447.1333717297385389
500002.1836.510273837297
1000004.3774.719007770631
Time, peak memory and output size by workbook size Source: Test T15 · markitdown 0.1.9 · cloud lab container, one run each · xlsx-scale.csv · Download CSV

Time and memory grow roughly in step with the row count: 100,000 rows took 75 seconds and 1.9 GB. A 4 MB workbook becomes 7.8 million characters of Markdown, far more than any model reads, so convert only the sheets and rows you need. We did not reproduce the upstream report of a 102 MB workbook that never finished, because we did not generate a file of that size.

Convert one sheet, or a range

There is no sheet-selection option on the command line. Split the output on the ## headings:

Pythonapi-xlsx-split.py
from markitdown import MarkItDown

markdown = MarkItDown().convert("samples/xlsx-sheets.xlsx").markdown
sheets = {}
for block in markdown.split("\n## ")[0:]:
    block = block.removeprefix("## ")
    name, _, body = block.partition("\n")
    sheets[name.strip()] = body.strip()
print(list(sheets))
print(sheets["Notes"])
Output · markitdown 0.1.9 · Python 3.13.18 · 2026-11-15
['Rainfall', 'Notes']
| Key | Value |
| --- | --- |
| battery | low |

captured result

Errors specific to Excel files

XlsxConverter threw MissingDependencyException means the xlsx extra is missing, and the legacy equivalent is XlsConverter (xls extra); see the missing-dependency page. We did not test corrupt or password-protected workbooks.

Version notes

The xlsx and xls converters arrived as extras in since 0.1.0, when all optional dependencies were split out (extras). We did not find other spreadsheet changes in the release notes we read.