Markdown Table to Excel: 3 Ways Compared
Three ways to turn a Markdown table into a real .xlsx — an online converter, Excel's Text to Columns, and Python — plus the gotchas that break them.
Markdown tables are everywhere now: README files, docs sites, Notion exports, and — increasingly — tables that an LLM just generated in a chat window. Excel cannot open a .md file, and pasting pipe-delimited text straight into a sheet puts the whole table in column A. Here are three ways to fix that, ranked by how much of your afternoon they cost.
Quick answer
- One table, want it in 20 seconds: use the Markdown table to Excel converter. Paste, download
.xlsx, done. Runs in the browser. - Have Excel open, need it once: paste into a cell, then Data → Text to Columns with
|as the delimiter. Remember to delete the separator row. - A folder of READMEs, need it weekly: write a five-line Python function. Repeatable and doesn’t care how many tables there are.
- The table only exists as a photo or screenshot: use the JPG to Excel converter, which reads the grid out of the image first and then builds the same workbook.
Take this table as the running example:
| Name | Age | City |
|-------|-----|----------|
| Alice | 30 | New York |
| Bob | 25 | London |
Method 1: the browser converter (fastest)
- Open Markdown table to Excel.
- Paste the Markdown into the editor, or drop a
.mdfile onto it. - Check the preview — rows, columns and headers should look like the table you meant.
- Click Convert to Excel (.xlsx) and open the download.
What you get back is a formatted workbook, not a raw dump: a styled header row, zebra striping, auto-fitted column widths, a frozen header row and auto-filters. Number-looking cells are stored as numbers, so SUM works immediately instead of silently treating 30 as text.
The reason it is worth using a converter rather than splitting by hand is that it parses the pipe syntax properly instead of treating the table as a string. If your file has several tables, each becomes its own worksheet — which is why this option wins for documents rather than single tables.
Because the conversion happens in client-side JavaScript, the data never leaves your machine. That matters if the table is an internal report you are not supposed to paste into a random website.
Method 2: Excel’s Text to Columns (no tools, one-off)
For a single table and a dislike of new websites:
- Copy the Markdown table, including the header and separator rows.
- Paste it into cell A1. Everything lands in one column — that is expected.
- Select column A → Data → Text to Columns → Delimited → Next.
- Tick Other and type
|in the box. Untick everything else. - Finish. Now delete the leftover pieces: the empty column created by the leading pipe, and the
|---|---|separator row.
Two details trip people up. The separator row (|-------|-----|) survives as a row of dashes and must be deleted manually. And because Markdown tables usually start and end with a pipe, splitting produces an empty first and last column — delete both.
Google Sheets works the same way: paste, then Data → Split text to columns, custom separator |.
Method 3: a Python snippet (repeatable)
If this is a weekly chore rather than a one-off, script it. No library parses Markdown tables as cleanly as twenty lines you control:
import re
import pandas as pd
def md_table_to_df(markdown: str) -> pd.DataFrame:
lines = [ln.strip() for ln in markdown.strip().splitlines()]
rows = [
[cell.strip() for cell in ln.strip("|").split("|")]
for ln in lines
if ln.startswith("|")
]
# drop the |---|---| alignment row
rows = [r for r in rows if not re.fullmatch(r"[-: ]+", "".join(r))]
return pd.DataFrame(rows[1:], columns=rows[0])
df = md_table_to_df(open("table.md").read())
df.to_excel("table.xlsx", index=False)
To batch a directory, loop over the files, extract every fenced ```markdown block with a regex, and write each one to a separate sheet using pd.ExcelWriter.
with pd.ExcelWriter("all_tables.xlsx") as writer:
for i, block in enumerate(blocks):
md_table_to_df(block).to_excel(writer, sheet_name=f"table_{i}", index=False)
This is the right answer when the tables come from a pipeline, but it is the wrong answer for one table — you will spend longer installing pandas and openpyxl than converting by hand.
Which one should you use?
| Situation | Method |
|---|---|
| One table you need in Excel now | Online converter |
| A table plus styling you don’t want to redo | Online converter — headers, widths and filters are applied |
| Confidential table, no uploads | Text to Columns, or the Python script |
| Every table in a long document | Online converter — one worksheet per table |
| Recurring data pipeline | Python script |
| A quick look at a table on a phone | Google Sheets → Split text to columns |
The pipe-syntax gotchas
These are the ones that produce silently wrong spreadsheets:
The alignment row is data. In a naive split, |:---|---:| becomes a real row. Always drop it.
Leading and trailing pipes create empty columns. | Alice | 30 | has an empty cell before Alice if you split on | without stripping the outer pipes first.
Escaped pipes inside cells. A cell containing a literal pipe is written \|. A naive split("|") breaks that row into one extra column, and every value after it shifts left. Guard for \\| before splitting.
Multi-line cells are not part of the spec. GFM tables cannot represent a cell with a line break. If your source had a paragraph in a cell, it will have been flattened or dropped before it reached Markdown — no converter can recover it.
Numbers arrive as text. After Text to Columns, a column of 30, 25 may be left-aligned and sum to zero. Select the column, then Data → Text to Columns → Finish again, or use VALUE().
Dates change format silently. 03/04/2026 is March 4th or April 3rd depending on locale. Check one cell before trusting the column.
Getting better tables out of an LLM
If your Markdown table came from a chat model, ask for it as a fenced code block and specify that you want a GFM table with a header row. Models will happily emit a visually aligned ASCII table with padded spaces instead — that looks fine in a terminal and converts badly. A prompt like “output the result as a GitHub-flavoured Markdown table inside a code block, no extra commentary” produces something a converter can parse.
If the table is trapped in an image or a scanned PDF instead, run it through ExtractFromIMG first — the same layout model that pulls LaTeX out of equations rebuilds tables as Markdown, and then you can export directly to .xlsx.
FAQ
Does Excel open Markdown files?
No. .md is plain text, and Excel will either refuse it or put each line in a single cell. You need to convert or split the table first.
Will the converted file keep merged cells? Markdown has no concept of merged cells, so there is nothing to keep. If the original table was merged in a spreadsheet and then flattened to Markdown, the merge information is already gone.
Can I convert .md to CSV instead?
Yes — the same three methods work; just save as CSV in the last step. Excel’s Text to Columns plus Save As → CSV UTF-8 is fine for a one-off, and pandas has to_csv.
What if my table has more than 1,048,576 rows? Markdown is not a data format; at that scale you want CSV or Parquet. Convert to CSV first, then use Power Query or pandas rather than a spreadsheet.
Is the online converter safe for internal data? The conversion runs entirely in your browser — the Markdown is never uploaded to a server, so nothing leaves your machine.