Eskillsfy

Home / Blog / Data and formats

Data and formats · 23 Nov 2026

Markdown Table Generator: how it works and how to build one

Turn CSV or spreadsheet cells into a Markdown table. This guide explains what happens behind the button and shows the code, so you can build your own.

What it does

Copy cells from Excel or Google Sheets (they paste as tab-separated text) or open a CSV, and get a neatly padded Markdown table for READMEs, GitHub issues and docs. Choose column alignment.

When to use it

  • README files
  • GitHub issues and pull requests
  • Docs sites

How to use it

  1. Paste cells from a spreadsheet or open a CSV.
  2. Choose the alignment.
  3. Copy the table into your Markdown file.

Try it free in your browser, nothing is uploaded: https://eskillsfy.com/tools/markdown-table-generator

How it works

The tool parses CSV or tab-separated cells (what you get when copying from Excel) into rows, finds the widest value in each column, and pads every cell so the table lines up in plain text.

The second line of a Markdown table sets alignment: :— left, :—: center, —: right.

Build it yourself

Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any TypeScript or JavaScript project.

markdownTable.ts (ts)

export function markdownTable(rows: string[][]) {
  const cols = Math.max(...rows.map((r) => r.length));
  const cells = rows.map((r) => Array.from({ length: cols }, (_, i) => (r[i] ?? "").replace(/\|/g, "\\|").trim()));
  const width = Array.from({ length: cols }, (_, i) => Math.max(3, ...cells.map((r) => r[i].length)));
  const line = (r: string[]) => `| ${r.map((c, i) => c.padEnd(width[i])).join(" | ")} |`;
  return [line(cells[0]), `| ${width.map((w) => "-".repeat(w)).join(" | ")} |`, ...cells.slice(1).map(line)].join("\n");
}

// Spreadsheet cells paste as tab-separated text:
const rows = clipboardText.trim().split("\n").map((l) => l.split("\t"));

Make it production-ready

  • Use a real CSV parser for quoted fields.
  • Add per-column alignment.

Questions

Can I paste from Excel?

Yes. Cells copied from Excel or Sheets are tab-separated, and tabs are detected automatically.

Try the Markdown Table Generator

Free, runs in your browser, nothing is uploaded.

Open it
Keep reading

More in Data and formats

All posts