microsoft / microsoft/markitdown
XLSX/XLS: pipe characters in cells break Markdown tables
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
- 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 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