How to use the markdown table to csv converter
- Paste text that contains a Markdown or GitHub table. Other text around the table is fine.
- If the text holds several tables, enter the number of the one you want. They are numbered in the order they appear.
- Choose CSV, tab separated text or JSON objects.
- Copy the result, or use the CSV download to open it in a spreadsheet.
Formula
header line, then a delimiter line such as | :--- | ---: |, then the rows
split each line on pipes that are not written as \|, and trim the cells
drop the delimiter line, pad short rows with empty cells, drop cells past the last column
CSV: wrap a cell in quotes if it holds a comma, a quote or a line break, and double any quotes
The two header lines must have the same number of cells. The colons in the delimiter line set alignment and are reported, but they do not change the data.
A three column table
A table with the header Item, Qty and Price, the alignment row | :--- | ---: | ---: | and the rows Apples 3 1.20, Pears green 2 1.50 and Plums \| ripe 10 0.80 becomes four lines of CSV. The first line is Item,Qty,Price, and the third is written as "Pears, green",2,1.50 because that cell holds a comma. The escaped pipe in the last row becomes a plain pipe, so the cell reads Plums | ripe.
The same table in JSON objects has the keys Item, Qty and Price and one object per data row. The summary lists the tables found, the alignment of each column (left, right, right here) and how many cells were dropped for lying past the last column.
What counts as a table
A table is a line with pipes, then a line made only of dashes with optional colons, then data lines. The outer pipes are optional, and a table ends at a blank line or at a line without a pipe. Text that merely contains a pipe, such as a command with a vertical bar, is not mistaken for a table unless the next line is a delimiter line.
To build a table, use the Markdown Table Generator. To move the data on, the CSV and JSON Converter changes format, and the CSV Validator checks the file before you import it. A bookmark export has its own converter in the Bookmarks HTML to CSV Converter.
Limits worth knowing
Markdown inside cells, such as bold marks, links and code spans, is copied as it was typed, since the tool does not render Markdown. A cell cannot hold a line break in a pipe table, so no cell does. Tables with merged cells do not exist in this format, and a table with more than 5,000 rows or 200 columns is refused.
Assumptions and limits
- The table follows the GitHub flavored Markdown layout with a delimiter line.
- A pipe inside a cell is written as \|. Pipes inside code spans must be escaped as well, as in that format.
- Cells keep their text but lose the spaces around them.
- Up to 500,000 characters are read, and nothing is uploaded.
Frequently asked questions
Why was my table not found?
Check that the line under the header holds only dashes, colons, spaces and pipes, and that it has the same number of cells as the header. Without that line the text is not a table in this format.
Can the tool read tables from a README on a website?
It reads the Markdown source. Copy the raw text of the file, not the formatted page, since pasted formatted tables lose the pipes.
What happens to a short row?
It is padded with empty cells so every row has the same number of columns as the header. A longer row is cut at the last column and the count of dropped cells is shown.
Does it keep the column alignment in CSV?
No. CSV has no way to store alignment. The alignment is listed in the summary so you can use it in another tool.