Markdown to Excel: Convert Tables to .xlsx or CSV

November 11, 2026 · 10 min read

Markdown to Excel: Turn Markdown Tables into .xlsx or CSV

To convert markdown to Excel, split each table row on its pipe characters, then drop the empty edge columns and the dashed separator row. You can do that with Excel's Text to Columns, Power Query, a browser converter, pandas or Pandoc. Below are all five, with the cleanup each one needs.

How Do You Convert Markdown to Excel?

A Markdown pipe table is plain text, and Excel doesn't treat its pipes as column breaks. Every route does the same three jobs: split on |, throw away the |---| delimiter row, and stop Excel from guessing the wrong data types. Pick the route that matches how often you'll do it.

MethodWhat you needOutputBest for
Paste + Text to ColumnsAny desktop ExcelCells in the open sheetOne small table, once
Power QueryDesktop Excel with From Text/CSVA refreshable queryA .md file that keeps changing
Browser converterA web browser.xlsx or CSV downloadQuick jobs, no install
pandasPython with openpyxl.xlsx and .csv filesScripts and batches
Pandoc to HTMLPandoc installedAn .html table Excel can readFiles with several tables

Here's the table we'll use in every example. It has four traps on purpose: leading zeros, an escaped pipe, a comma inside a cell and an ISO date.

| Order ID | Item               | Qty | Ship date  |
|----------|--------------------|----:|------------|
| 00142    | USB-C cable \| 2 m | 3   | 2026-11-03 |
| 00157    | Desk lamp          | 1   | 2026-11-04 |
| 00163    | Notebook, A5       | 12  | 2026-11-05 |

On GitHub this renders as a three-row table, and the second cell reads "USB-C cable | 2 m". The GFM table spec treats \| as a literal pipe inside a cell. If the syntax itself is new to you, start with our Markdown table syntax guide.

Can You Paste a Markdown Table into Excel?

Yes, but raw Markdown pastes as plain text, one whole row per cell in column A. Text to Columns fixes that in under a minute.

If any cell holds an escaped pipe (\|), first use Find and Replace in your text editor to swap \| for a placeholder such as #PIPE#. Excel would otherwise split it like any other pipe.

  1. Paste the table into A1 and select column A.
  2. Go to Data > Text to Columns, choose Delimited, then Next.
  3. Untick the other delimiters, tick Other and type | in the box.
  4. On the last step, select the Order ID column and set Column data format to Text. Do the same for any ZIP code or ID column. Click Finish.
  5. Delete the empty first column (it comes from the leading pipe), any empty column left by the trailing pipe, and the row of dashes.

The Text Import Wizard reference documents the Other box and the General, Text and Date formats. Padded cells keep their spaces after the split, so clean them with =TRIM(B2) in a helper column and paste the results back as values. Then replace #PIPE# with | to restore the escaped cell.

In Microsoft 365 or Excel 2024, =TRIM(TEXTSPLIT(A1,"|")) splits a single row with a formula instead. Google Sheets works the same way as the wizard: paste, then Data > Split text to columns and choose a custom separator.

Tables Copied from ChatGPT, Claude and Other AI Chats

A lot of Markdown tables now start life in an AI chat, and how you copy them matters. If you select the rendered table on screen and copy it, the browser usually puts an HTML version on the clipboard. Excel then pastes real cells with no splitting needed. Our HTML table tutorial explains the row and cell tags behind that version.

The copy button under a reply may give you the raw Markdown instead, depending on the app. If that pastes as pipes in column A, use the Text to Columns steps above or the browser converter below. If the answer looks garbled, paste it into the editor first: the preview shows whether it's a valid table or a broken one with a missing separator row.

Markdown Table to Excel with Power Query

Power Query suits a Markdown file that you update and re-import every week. Save the table as a .txt file. Then, on the Data tab, click From Text/CSV in the Get & Transform Data group and pick the file.

In the preview dialog, choose a custom delimiter and type |. The Text/CSV connector docs confirm that a custom delimiter can be any string, and that you can turn off data type detection so every column loads as Text. Set the Data Type Detection dropdown to Do not detect data types, because that's what protects 00142.

Click Transform Data, remove the two blank edge columns, filter out the dashes row, and run Transform > Format > Trim on the text columns. If the headers still sit in row 1, click Use First Row as Headers. Close & Load puts the table in a sheet. Next time the file changes, Refresh reruns every step.

The limitation: Power Query still splits on escaped \|, and the dashes filter is a manual step you set up once per query.

Download an .xlsx File in Your Browser

If you don't want to touch the ribbon at all, our Excel and Markdown table converter does the job without Excel open. Switch to the Markdown to Excel tab, paste one table and click Download .xlsx. It reads the first table it finds and gives you a one-sheet workbook with the header in row 1.

The converter reads \| as a literal pipe and drops the separator row for you. It writes every cell as text, so 00142 stays 00142, but Qty also arrives as text. Select that column in Excel and convert it to numbers before you sum it.

Only cell values come across. Markdown has no formulas, merged cells, colours or charts to carry. If the table is a mess of uneven pipes, tidy it with the Markdown table formatter first. Both tools run in your browser, cost nothing and have no daily limit.

How Do You Convert Markdown to CSV?

A Markdown table to CSV conversion is the same split, written out with commas. Paste the table into our CSV converter, switch to Markdown to CSV, and copy the result. Any cell that contains a comma, such as "Notebook, A5", gets wrapped in double quotes, which is the rule RFC 4180 sets for CSV.

Order ID,Item,Qty,Ship date
00142,USB-C cable | 2 m,3,2026-11-03
00157,Desk lamp,1,2026-11-04
00163,"Notebook, A5",12,2026-11-05

That's the exact CSV our pandas script below writes. Pick CSV when another program will import the data, such as a database, a CRM or a script. Pick .xlsx when people will open it in Excel. If you double-click a CSV, Excel applies General format to every column by default, so 00142 turns back into 142. Import it through From Text/CSV with type detection off to keep the zeros.

Markdown to Excel in Python with pandas and Pandoc

We prefer pandas for anything repeatable or anything with more than one table. pandas has no Markdown reader, but read_csv accepts a regex separator when you use the Python engine. This script ran on pandas 3.1 with openpyxl installed (pip install pandas openpyxl; add lxml for the read_html step later):

import pandas as pd

df = pd.read_csv(
    "table.md",
    sep=r"\s*(?<!\\)\|\s*",   # split on pipes, but not on escaped \|
    engine="python",
    dtype=str,                # keep 00142 as text
)
df = df.dropna(axis=1, how="all")         # empty edge columns from the outer pipes
df = df[~df.iloc[:, 0].str.match(r"^:?-+:?$")]  # drop the |---| separator row
df = df.apply(lambda col: col.str.replace(r"\|", "|", regex=False))

df["Qty"] = pd.to_numeric(df["Qty"])

df.to_excel("table.xlsx", index=False)
df.to_csv("table.csv", index=False)

The separator trims padding and skips escaped pipes. The script drops the all-empty edge columns, removes the dashes row, and restores \| to |. In the resulting table.xlsx, Order ID is text, Qty is a number and Item reads "USB-C cable | 2 m".

Pandoc: Markdown to HTML first

Pandoc can't write .xlsx or CSV (CSV is an input format only), but it turns pipe tables into clean HTML:

pandoc -f gfm -t html table.md -o table.html

Open table.html in a browser and copy the table into Excel, or read it with pd.read_html("table.html", converters={"Order ID": str}). That returns one DataFrame per table in the file. In our test, leaving out converters turned 00142 into 142. No Pandoc installed? The converter below does the same Markdown to HTML step on the sample table:

Orders to import

Order ID Item Qty Ship date
00142 USB-C cable | 2 m 3 2026-11-03
00157 Desk lamp 1 2026-11-04
00163 Notebook, A5 12 2026-11-05

The escaped pipe shows as a plain pipe in the Item cell. Click Export HTML to get the HTML table.

68 words302 characters9 lines
Markdown

What Breaks When a Markdown Table Becomes a Spreadsheet

Even a clean split leaves a few things for you to fix by hand:

  • Leading zeros: General format strips them from IDs and ZIP codes. Set those columns to Text before the split, not after.
  • Dates: Excel turns 2026-11-03 into a date serial, and strings like 3-4 or 1/2 can become dates too. Mark them as Text if they aren't dates.
  • Long numbers: Excel keeps 15 significant digits, so the 16th digit of a long ID becomes a zero and the cell may show scientific notation. Import it as Text.
  • Inline formatting: **bold**, [links](url) and <br> arrive as literal characters. Strip them with Find and Replace.
  • Alignment colons: --: means right-aligned in Markdown but means nothing to Excel. Reapply alignment with the Excel ribbon after you delete the separator row.

For the reverse trip, from a sheet back to a pipe table, see our CSV to Markdown table guide.

Quick Answers on Markdown Tables and Spreadsheets

The fastest route for markdown to Excel depends on the job. Use Text to Columns for one small table, Power Query for a file you re-import, and pandas for batches. Whichever you pick, set ID and date columns to Text before Excel guesses. For a quick conversion with no install, paste your table into the Markdown to Excel tool and download the .xlsx.