Skip to main content

Overview

MarkItDown provides two converters for Excel files:
  • XlsxConverter - For modern Excel files (.xlsx, Excel 2007+)
  • XlsConverter - For legacy Excel files (.xls, Excel 97-2003)
Both converters extract data from all sheets and present each as a separate Markdown table.

Dependencies

XLSX requires: pandas, openpyxl
XLS requires: pandas, xlrd

XlsxConverter

Accepted Formats

list
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
list
  • .xlsx

Class Definition

Constructor

Methods

accepts()

Returns True for .xlsx files.

convert()

Converts an XLSX file to Markdown. Returns: DocumentConverterResult with all sheets as Markdown tables Raises: MissingDependencyException if dependencies not installed

Example Usage

Output Example

XlsConverter

Accepted Formats

list
  • application/vnd.ms-excel
  • application/excel
list
  • .xls

Class Definition

Constructor

Methods

accepts()

Returns True for .xls files.

convert()

Converts an XLS file to Markdown. Returns: DocumentConverterResult with all sheets as Markdown tables Raises: MissingDependencyException if dependencies not installed

Example Usage

Implementation Details

Source Location

~/workspace/source/packages/markitdown/src/markitdown/converters/_xlsx_converter.py
  • XlsxConverter: Line 36
  • XlsConverter: Line 98

Conversion Pipeline

Both converters use the same process:
  1. Read All Sheets - Load all worksheets using pandas
  2. Convert to HTML - Each sheet converted to HTML table
  3. HTML to Markdown - HTML table converted to Markdown
  4. Combine Sheets - All sheets joined with H2 headers

Sheet Headers

Each sheet is prefixed with an H2 heading using the sheet name:

Features

Supported Elements

  • Data Types - Numbers, text, dates, booleans
  • Multiple Sheets - All sheets included with headers
  • Formulas - Evaluated values shown (not formula text)
  • Merged Cells - Handled by pandas

Data Handling

  • Index Column - Not included (index=False)
  • Column Names - First row used as header
  • Missing Values - Empty cells rendered as empty table cells
  • Formatting - Cell formatting (colors, fonts) not preserved

Limitations

  • Charts and images not extracted
  • Cell styling and colors not preserved
  • Formulas shown as values, not expressions
  • Macros and VBA code not included
  • Multiple tables per sheet may merge
  • Conditional formatting not preserved
  • Comments and notes not extracted

Performance Considerations

  • Entire workbook loaded into memory
  • Large spreadsheets may require significant RAM
  • Processing time scales with number of sheets and cells