microsoft / microsoft/markitdown

XLSX/XLS: pipe characters in cells break Markdown tables

Open
#2,436 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

A literal | in an Excel cell value or header is data, not a column separator, but it is emitted raw, so converted rows gain phantom columns and the Markdown table is corrupt.

Repro (markitdown[xlsx], current main):

import io
import pandas as pd
from markitdown import MarkItDown

buf = io.BytesIO()
with pd.ExcelWriter(buf, engine="openpyxl") as w:
    pd.DataFrame({"a": ["x|y"], "b": ["2"]}).to_excel(w, index=False)
print(MarkItDown().convert_stream(buf.getvalue(), file_extension=".xlsx").markdown)

Actual (2-column table, 3-column row):

## Sheet1
| a | b |
| --- | --- |
| x|y | 2 |

Expected: | x\|y | 2 |, the same escaping the CSV converter already applies (see #2019 / #2266). Same problem in the .xls converter.

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 provided pandas/openpyxl reproduction through MarkItDown().convert_stream, then compare the XLSX and XLS converters with the CSV converter’s escaping referenced in #2019 and #2266. Done means literal pipe characters in spreadsheet cells and headers are escaped in the generated Markdown table without adding phantom columns.

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
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.