---
title: "Turn a CSV file or a Google Sheet into a Markdown table"
author: Pedro Thomaz
source: https://coffeetext.app/blog/csv-to-markdown-table
---

# Turn a CSV file or a Google Sheet into a Markdown table

> Checked November 2026 against the [pandoc manual](https://pandoc.org/MANUAL.html), [csvkit's csvlook docs](https://csvkit.readthedocs.io/en/latest/scripts/csvlook.html) and [Google's help on downloading a file](https://support.google.com/docs/answer/49114). I make Coffee, so weigh what I say about it. Coffee isn't affiliated with any of them.

A CSV file is already a table, just written with commas. Turning it into a Markdown table means swapping the commas for pipes and adding a row of dashes under the header. The work is in the details: a comma inside a cell, a quoted field, a semicolon file from a European spreadsheet.

Here are four ways to do it, from no install at all to a line in Terminal.

## What you start with and what you want

A CSV file like this:

```
Item,Cost,Note
Rent,900,"Due on the 1st, by transfer"
Food,300,
```

should become:

```
| Item | Cost | Note |
| --- | --- | --- |
| Rent | 900 | Due on the 1st, by transfer |
| Food | 300 | |
```

Notice the third column of the first row. The comma inside the quotes belongs to the cell, so a converter that splits on every comma gets that row wrong. Any of the ways below that reads CSV properly handles it.

## 1. A converter in your browser

The quickest is [the free Excel to Markdown converter on this site](https://coffeetext.app/tools/excel-to-markdown). Paste CSV, or cells copied from Excel, Google Sheets or Numbers, and the table appears as you paste. It finds tabs, commas or semicolons by itself, so a CSV saved by a spreadsheet set to a European region, with semicolons between the fields, works too.

It has a few choices worth knowing:

- **Align columns** adds the colons: `:---` left, `:---:` centre, `---:` right.
- **Numbers to the right** right-aligns only the columns of figures.
- **Line up the pipes** pads the cells so the source reads as a grid.
- **First row is the header**, on by default.

The conversion runs in the page, so nothing you paste is sent to a server or stored. That matters for a budget or a client list. Pipes in a cell are escaped so they don't split it, and a line break in a cell becomes `<br>`.

## 2. From Google Sheets

You don't need to save a file first. Select the cells in Google Sheets, copy, and paste them into the converter or a Markdown editor that converts on paste. Spreadsheets copy cells as text with tabs between the columns, which is easier to convert than CSV because a tab rarely appears inside a cell.

If you do want the file, [Google's help](https://support.google.com/docs/answer/49114) puts downloads under File › Download, where you choose the file type, CSV among them.

## 3. In Terminal, with pandoc or csvkit

If you convert files often, or a script does it for you, a command is better.

**Pandoc** lists `csv` among the formats it reads, according to [its manual](https://pandoc.org/MANUAL.html), so a whole file becomes a GitHub-style table in one line:

```
pandoc -f csv -t gfm budget.csv -o budget.md
```

**csvkit** has `csvlook`, which its [docs](https://csvkit.readthedocs.io/en/latest/scripts/csvlook.html) describe as rendering a CSV "in a Markdown-compatible, fixed-width format":

```
csvlook budget.csv > budget.md
```

Both read quoted fields properly. Check the result in your editor once: tools differ on how they write the dashes row and pad cells, though any of them renders as a table.

For cells you've copied rather than a file, there's a one-line `pbpaste` command in [pasting an Excel or Numbers table](https://coffeetext.app/blog/paste-excel-numbers-table-markdown).

## 4. Paste into your editor

Some editors convert cells as you paste. In Coffee, copy cells from Excel, Numbers or Google Sheets and press ⌘V on an empty line: they arrive as a Markdown table. It needs at least two rows and two columns with the same number of columns in each row; anything else pastes as plain text. That's for copied cells; for a `.csv` file, open it in a spreadsheet and copy, or use one of the ways above.

Once the table is in a Coffee note on the Mac, a cell written `=sum` under a column shows its total, and `=average`, `=count`, `=min`, `=max` and `=median` work too. The file keeps the formula, so other apps see `=sum`.

## What a Markdown table can't keep

Whichever way you convert, a Markdown table holds less than a spreadsheet. No merged cells, so every row has the same number of columns. No formulas, so you get the values as they were. No colours or column widths. The [Markdown tables guide](https://coffeetext.app/blog/markdown-tables-guide) covers the rules, alignment and what breaks a table.

If the data changes every week, think twice about converting it at all. A link to the sheet, or a table you regenerate with a command, saves fixing the same table by hand.

## Questions

### How do I convert a CSV to a Markdown table without installing anything?

Paste the CSV into [the free converter on this site](https://coffeetext.app/tools/excel-to-markdown). It runs in your browser, finds commas, semicolons or tabs, and gives you a table to copy.

### What about commas inside a cell?

A proper CSV puts that cell in double quotes, and the comma stays in the cell. The browser converter, pandoc and csvkit all read quoted fields.

### Can pandoc read CSV?

Yes. Its manual lists `csv` as an input format, so `pandoc -f csv -t gfm file.csv` gives a Markdown table.

### Does a Google Sheet need to be saved as CSV first?

No. Copy the cells and paste them into a converter or an editor that converts on paste. Copied cells come across with tabs between the columns.

Coffee is for the Mac, on macOS 15 or later, with an app for iPhone and iPad. It's free for 14 days without a card, then €3 a month, €29 a year, or €79 once with two years of updates.

---

Written by Pedro Thomaz, who makes Coffee, a Markdown editor for the Mac on macOS 15 or later, and for iPhone and iPad. It's free for 14 days with no card or account, then €3 a month, €29 a year, or €79 once with two years of updates. More at https://coffeetext.app/llms-full.txt
