Turn an Excel Table into a Markdown Table for GitHub: Line Breaks in Cells, Full-Width Text and Right-Aligned Numbers That Survive the Conversion, and Getting a Markdown Table Back into Excel
How to convert a table copied from Excel into a Markdown table for GitHub or Qiita. Why line breaks inside a cell (Alt+Enter) do not shift the rows, how full-width characters are counted for column widths, how numeric columns get right-aligned, what changes in Confluence, Backlog and LaTeX, and how to turn a README table back into Excel, checked on the English screen of the Table Converter.
Contents
You have a sales-by-branch table in Excel and want to put it in a GitHub Issue or a Qiita article (Qiita is a technical blogging site widely used by Japanese developers). If you select it, copy it and paste it into a plain-text box, you do not get a table, just text separated by tabs. Typing the | and --- by hand is no better: one missing column or a forgotten separator row under the header is enough to break the table.
The Table Converter is a browser tool that takes a table copied from Excel or a spreadsheet and converts it into a Markdown, HTML, Backlog, Confluence/Jira, Redmine (Textile) or LaTeX table. Backlog is a project management service popular with Japanese teams. It also works in the other direction, turning a Markdown table from a README back into something you can paste into Excel. In this article I used a Japanese table with a line break inside one cell and checked what the tool produces and why. Full-width characters such as Japanese, Chinese and Korean text are the hard case for column widths, which is why the sample keeps the original Japanese labels.
Turning an Excel table into a Markdown table
The table I used has 4 rows and 4 columns: branch (支店), manager (担当者), sales in thousands of yen (売上(千円)) and year-on-year change (前年比). Only the manager cell for the Fukuoka branch is split into two lines with Alt+Enter: 山本 (Yamamoto) and (4月から) (“from April”).
| 支店 | 担当者 | 売上(千円) | 前年比 |
|---|---|---|---|
| 東京本店 | 佐藤 | 12,480 | 104.2% |
| 大阪支店 | 田中 | 8,315 | 98.7% |
| 福岡支店 | 山本 (line break) (4月から) | 3,902 | 112.5% |
- In Excel, select A1 to D4 including the header and copy with Ctrl+C (⌘+C on a Mac).
- Open the tool, clear the “Table to convert” box and paste. Paste exactly what you copied from Excel.
- Check that “Output format” is “Markdown (GitHub, Qiita, Zenn, GitLab)”. The input format is detected automatically. If the line under the box says “Read 4 rows × 4 columns as “Tab-separated (Excel, spreadsheets)”.”, the table has been read as 4 rows by 4 columns.
- Check the “Converted result”, press “Copy result” and paste it where you need it.
This is the result:
| 支店 | 担当者 | 売上(千円) | 前年比 |
| -------- | ------------------- | -----------: | -----: |
| 東京本店 | 佐藤 | 12,480 | 104.2% |
| 大阪支店 | 田中 | 8,315 | 98.7% |
| 福岡支店 | 山本<br>(4月から) | 3,902 | 112.5% |
Why a line break inside a cell does not shift the rows
When a cell contains a line break, Excel copies it in tab-separated form wrapped in quotation marks, like "山本⏎(4月から)". If you look at the pasted box, the Fukuoka row spans two lines. A converter that simply splits rows at every line break would turn this into a 5-row table, with (4月から) landing in the branch column.
This tool treats a line break inside quotation marks as part of the same cell, so the “Preview of the parsed table” at the bottom also shows the Fukuoka manager as one cell displayed on two lines. Markdown has no syntax for a line break inside a table cell, so the output uses <br> instead, and GitHub renders <br> in a table cell as a line break. If you check in this preview that the numbers of rows and columns match the original table before converting, you will not discover the breakage only after pasting.
Column widths with full-width text, and right alignment
A Markdown table renders correctly even if the columns in the source are not the same width. Still, when the source stays in a README, it is easier to read when the vertical bars line up. With “Align column widths” checked, the tool counts each full-width character as two half-width characters when padding the columns. That is why 東京本店 and -------- have the same width in the output above.
The sales and year-on-year columns end with a colon, as in -----------:. This means right-aligned. When “Column alignment” is “Auto (right-align numeric columns)”, the marker is added to every column in which all cells apart from the header are numbers such as 12,480 or 98.7%. Values with thousands separators or percent signs still count as numbers, so the digits line up. To align left or center instead, choose it in this drop-down.
Turning a README Markdown table back into Excel
When you want to re-total a table from a README or an Issue, do the reverse.
-
Paste the Markdown table as is into “Table to convert”. As an example I used the following table, which has a
|and a line break inside a cell (項目 = item, 状態 = status, 備考 = notes; バックアップ = backup, 監視 = monitoring, 保留 = on hold, 週1回 = once a week, 要確認 = needs checking).| 項目 | 状態 | 備考 | |:---|:---:|---:| | バックアップ | OK | 週1回 | | 監視 | 保留 | A\|B<br>要確認 | -
The line under the box says “Read 3 rows × 3 columns as “Markdown table”.”
-
Set “Output format” to “Tab-separated (paste into Excel)”.
-
Press “Copy result” and paste into cell A1 in Excel.
A\|B is how you write a literal | inside a Markdown table. The tool turns it back into A|B, and treats <br> as a line break inside an Excel cell (the same as Alt+Enter). In the output, the cell containing the line break between “A|B” and 要確認 is wrapped in quotation marks as "A|B⏎要確認", so pasting it into Excel puts two lines in a single cell.
The alignment markers (such as :---:) are kept when the table is read. If you convert back to Markdown with “Column alignment” left on automatic, the original alignment is reproduced.
What changes when the same table goes to another format
Changing “Output format” is all it takes to write the same table in another syntax. Using the sales-by-branch table again, I compared how line breaks and numbers are handled.
In Confluence and Jira wiki markup, header cells are separated by || and body cells by |.
||支店||担当者||売上(千円)||前年比||
|東京本店|佐藤|12,480|104.2%|
|大阪支店|田中|8,315|98.7%|
|福岡支店|山本 \\ (4月から)|3,902|112.5%|
The line break inside a cell becomes \\. This differs from Markdown’s <br>, so pick the format that matches where you are pasting.
In a LaTeX tabular, the column alignment is declared up front as in {llrr}, and only the numeric columns become r (right-aligned). % is escaped automatically as \%.
\begin{tabular}{llrr}
\hline
支店 & 担当者 & 売上(千円) & 前年比 \\
\hline
東京本店 & 佐藤 & 12,480 & 104.2\% \\
大阪支店 & 田中 & 8,315 & 98.7\% \\
福岡支店 & 山本 (4月から) & 3,902 & 112.5\% \\
\hline
\end{tabular}
Cells in a tabular cannot contain line breaks, so the Fukuoka cell is joined with a space as 山本 (4月から). When a table goes into a paper or report, some cells change like this because of the format’s limits. To compile a LaTeX table that contains Japanese text, you need an engine that supports Japanese, such as upLaTeX or LuaLaTeX.
Backlog notation (with h at the end of the header row), Redmine Textile (_. in header cells) and HTML tables can be produced with the same steps. The syntax of each is summarized on the tool page.
Where to look when the result comes out wrong
If the pasted table is not read the way you expected, check the following.
- The “Read ○ rows × ○ columns” count differs from the original table. A single-column table containing only numbers with commas (such as 12,480) has no tabs and may be mistaken for CSV. Setting “Input format” to “Tab-separated” fixes it.
- Merged cells come out empty. When you copy merged cells in Excel, only the top-left cell holds the value. Markdown and Backlog have no way to merge cells, so the rest become empty cells. A warning under the result tells you they were split.
- The number of digits is different. Excel copies values as they are displayed in the cell (with thousands separators, %, and rounded decimals). If you need the original precision, change the number format in Excel before copying.
- Bold text and colors disappear. Formatting is not carried over; only the text in the cells is converted.
All processing happens in the browser, so pasting an internal sales table or a customer list does not send it anywhere.