M

CSV to Markdown Table

Convert a CSV file into a Markdown table

No file selected.

CSV to Markdown Table — what it does

Convert a CSV into a Markdown table, complete with the header separator row that Markdown renderers need. The result pastes straight into a README, a wiki page, a pull request description or any documentation system that renders Markdown, without hand-typing a single pipe character.

Worked example

A five-item supplies list converted for a wiki page. One note contains a vertical bar and one is quoted in the CSV because it contains a comma.

Input — inventory.csv

item,notes,unit_price
Desk lamp,LED | dimmable,24.00
Notebook,A5 ruled,3.50
Stapler,"Half strip, metal",8.99
Pen box,12 black,2.10
Whiteboard,90x60 cm,39.00

Output — shown on the page and downloaded as table.md

| item | notes | unit_price |
| --- | --- | --- |
| Desk lamp | LED \| dimmable | 24.00 |
| Notebook | A5 ruled | 3.50 |
| Stapler | Half strip, metal | 8.99 |
| Pen box | 12 black | 2.10 |
| Whiteboard | 90x60 cm | 39.00 |

The vertical bar inside LED | dimmable is escaped as \| so it does not start a new cell, and the quoted value comes out without its quotes. Columns are not padded to equal width.

When this tool helps

  • Putting a comparison or specification table into a repository README.
  • Adding tabular results to an issue, pull request or code review comment.
  • Documenting configuration options or API fields from a spreadsheet you already maintain.

How to use it

  1. Choose the CSV file.
  2. Process the conversion.
  3. Review the generated Markdown table.
  4. Download or copy it into your document.

Accuracy, limits, and good practice

  • Pipe characters inside cell values need escaping in Markdown, or they will be read as column separators and break the row.
  • Markdown tables have no wrapping, so very wide tables scroll horizontally or overflow depending on the renderer.
  • Keep tables under roughly eight columns for readability; beyond that a definition list often communicates better than a grid.
  • Trim the table to the columns that make the point. A Markdown table wide enough to scroll defeats the reason for putting it in the document.

Frequently asked questions

Which Markdown flavours support tables?

Tables come from GitHub Flavored Markdown and are supported by GitHub, GitLab, most static site generators and nearly every wiki.

Can I control column alignment?

Markdown sets alignment with colons in the separator row. Add them to the generated output by hand where you need right or centre alignment.

Does it handle multi-line cells?

Markdown tables cannot contain real line breaks in a cell. Replace them with a break tag or shorten the content before converting.

Will the table render in a plain text email?

No, Markdown needs a renderer. In plain text the pipes and dashes appear literally, though the columns often still read acceptably.

What happens to rows that have fewer cells than the header?

Every row is padded to the widest row in the file with empty cells, so the table stays rectangular and renders correctly even when the source has ragged rows.

Is the first row always used as the header?

Yes. There is no option to switch it off: the first line becomes the header row and the --- separator follows it, so a file without headers would have its first data row promoted to the heading.

Related tools on this site

Everything above runs inside this page. CSV to Markdown Table needs no account, no upload, and no server round trip — close the tab and nothing is left behind.

CSV 轉 Markdown 表格能做什麼

把 CSV 轉成 Markdown 表格,並自動補上渲染器必需的標題分隔列。結果可以直接貼進 README、Wiki 頁面、Pull Request 說明,或任何支援 Markdown 的文件系統,完全不必手打直線符號。

實際範例

五項文具清單轉成 wiki 頁面的表格。其中一筆備註含直線字元,另一筆在 CSV 裡因含逗號而加了引號。

來源:inventory.csv

item,notes,unit_price
Desk lamp,LED | dimmable,24.00
Notebook,A5 ruled,3.50
Stapler,"Half strip, metal",8.99
Pen box,12 black,2.10
Whiteboard,90x60 cm,39.00

得到:頁面上顯示,並下載為 table.md

| item | notes | unit_price |
| --- | --- | --- |
| Desk lamp | LED \| dimmable | 24.00 |
| Notebook | A5 ruled | 3.50 |
| Stapler | Half strip, metal | 8.99 |
| Pen box | 12 black | 2.10 |
| Whiteboard | 90x60 cm | 39.00 |

LED | dimmable 裡的直線被逸脫成 \|,不會被當成新儲存格的起點;加了引號的值寫回時不帶引號。各欄不會補成等寬。

什麼時候用得上

  • 把比較表或規格表放進儲存庫的 README。
  • 在議題、Pull Request 或程式碼審查留言中附上表格結果。
  • 用你既有的試算表,記錄設定選項或 API 欄位說明。

使用步驟

  1. 選擇 CSV 檔案。
  2. 執行轉換。
  3. 檢視產生的 Markdown 表格。
  4. 下載或複製到你的文件中。

精確度、限制與實務建議

  • 儲存格內容含直線符號時必須逸出,否則會被當成欄位分隔而導致該列排版錯亂。
  • Markdown 表格不會自動換行,過寬的表格會依渲染器而水平捲動或溢出。
  • 為了可讀性,欄數建議控制在八欄以內;再多時,用定義式清單往往比表格清楚。
  • 請把表格精簡到能表達重點的欄位。寬到要捲動的 Markdown 表格,等於放棄了把它放進文件的理由。

常見問題

哪些 Markdown 支援表格?

表格源自 GitHub Flavored Markdown,GitHub、GitLab、多數靜態網站產生器與幾乎所有 Wiki 都支援。

可以設定欄位對齊嗎?

Markdown 以分隔列中的冒號設定對齊,需要靠右或置中時,在產生的結果中手動加上即可。

支援多行儲存格嗎?

Markdown 表格的儲存格無法包含真正的換行,請改用換行標籤或先縮短內容再轉換。

純文字郵件裡會渲染成表格嗎?

不會,Markdown 需要渲染器。純文字中直線與破折號會照原樣顯示,不過欄位通常還是勉強讀得懂。

儲存格比欄名少的列會怎樣?

每一列都以空儲存格補到檔案中最寬的那列,表格維持矩形,就算來源的列長短不一也能正常呈現。

第一列一定會被當成標題嗎?

是,沒有關閉的選項:第一行變成標題列,後面接 --- 分隔列,所以沒有標題的檔案會把第一筆資料升格成標題。

本站相關工具

以上步驟全部在這個頁面內完成,CSV 轉 Markdown 表格 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。