TToolbox
▤

Markdown Table Generator

Turn spreadsheet data into Markdown

About this tool

Markdown tables (standardized by GitHub Flavored Markdown) are the universal medium for tabulating structured metrics, feature comparisons, and configuration references in technical documentation. However, manually aligning vertical pipes `|`, hyphens `-`, and alignment colons `:` is notoriously frustrating when cells contain mixed CJK and English characters. This tool converts Excel and CSV data into perfectly padded Markdown tables with customizable column alignments in one click.

How to Use This Tool (Step-by-Step)

1

Paste Spreadsheet or Type Data

Copy rows and columns directly from Excel, Google Sheets, or CSV files and paste into the editor. Tab delimiters are auto-detected.

2

Configure Column Alignments

Set per-column alignments: Left (`:---`), Center (`:---:`), or Right (`---:`, ideal for numeric amounts and metrics).

3

Copy Formatted Markdown Table

The tool generates padded, visually aligned Markdown table markup. Copy with one click directly into your README or technical docs.

Direct Excel & CSV Clipboard Ingestion

Automatically parses tab-separated values copied from spreadsheet clipboards without requiring intermediate file exports.

CJK Double-Width Padding Alignment

Calculates CJK character widths as 2 monospace units, padding spaces accurately so the raw source text is perfectly aligned.

100% Client-Side Privacy

Data restructuring executes entirely within local browser memory. Sensitive commercial spreadsheets and roadmaps are never logged.

Markdown Table Typography & Multiline Tips

  • •Multi-line text inside a table cell: Raw newlines break table rows. Use HTML `<br>` tags to create line breaks within a single cell.
  • •Escape pipes inside cells: To print a literal vertical bar, write `\|`. Unescaped pipes split the cell into an unwanted extra column.
  • •Cap table column counts: Tables with more than 5 columns trigger horizontal overflow on mobile screens. Keep columns concise for responsive reading.

Code & Transformation Examples

Standard GFM Markdown Table Syntax Benchmark

Markdown Table Syntax
| 功能名称 | 适用场景 | 状态 | 耗时(ms) |
| :--- | :---: | :---: | ---: |
| JSON格式化 | API开发 | ✅ 支持 | 12 |
| 文本对比 | 合同审查 | ✅ 支持 | 25 |
| 假数据生成 | 单元测试 | 🚀 推荐 | 8 |
Alignment Colons Rule
• 冒号在左 (:---)   : 左对齐 (适合文本描述)
• 冒号两边 (:---:) : 居中对齐 (适合状态标签、图标)
• 冒号在右 (---:)   : 右对齐 (适合数字、价格、百分比)

* Delimiter rows require at least 3 hyphens. Keeping outer vertical pipes ensures maximum cross-platform rendering fidelity.

JavaScript 2D Array to Markdown Table Snippet

JavaScript Implementation
function toMarkdownTable(headers, rows) {
  const headerRow = '| ' + headers.join(' | ') + ' |';
  const dividerRow = '| ' + headers.map(() => '---').join(' | ') + ' |';
  const dataRows = rows.map(r => '| ' + r.join(' | ') + ' |').join('\n');
  return [headerRow, dividerRow, dataRows].join('\n');
}
Escaping Pipe Characters
若单元格正文中本身就包含竖线字符(|),必须使用反斜杠转义为 \|,否则会被 Markdown 解析器误拆为多余的列!

* Escaping literal pipe characters (`\|`) inside text is mandatory to prevent unexpected column splitting.

Frequently Asked Questions

Q: Why does the tool add spaces to pad cells in the source code?

A: While browsers collapse whitespace, monospace padding aligns vertical pipes in raw plain text editors, making source files visually pleasing.

Q: Can I convert a Markdown table back into an Excel spreadsheet?

A: Yes. Pasting a standard Markdown table directly into Excel or Google Sheets maps piped data columns back into spreadsheet cells cleanly.

Q: Is the header row mandatory in Markdown tables?

A: Yes. GFM specification strictly requires a header row followed by a delimiter line (`|---|`). Without it, parsers render plain text instead of tables.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/