How to convert an HTML table to CSV

CSV is the simplest way to move tabular data between tools: spreadsheets, databases, scripts. Turning a table from a web page into a CSV file that opens correctly everywhere has a few traps, though.

The usual traps

Method 1: through a spreadsheet

  1. Copy the table from the page and paste it into Excel, Numbers, LibreOffice or Google Sheets.
  2. Check that each value sits in its own cell.
  3. Use File > Save as (or Download > CSV in Google Sheets) and choose the CSV format.

This works well for small tables. Check the separator your spreadsheet uses before sending the file to someone in another country.

Method 2: with a script

If you program, libraries such as pandas in Python can read the tables of a page:

import pandas as pd
tables = pd.read_html("https://example.com/page")
tables[0].to_csv("table.csv", index=False)

This is ideal for automation, but it only sees tables present in the page's HTML, not those built by JavaScript or behind a login.

Method 3: export straight to CSV with TableSnap

  1. Open the page in Chrome and click the TableSnap icon (or press Alt+Shift+T).
  2. Pick the table in the list.
  3. Click CSV: the file downloads immediately.

The file is written to the RFC 4180 standard: values containing commas, quotes or line breaks are quoted correctly, merged cells are expanded, and a UTF-8 marker keeps accented characters readable in Excel. By default, the separator follows your system's language, so the file opens in the right columns on your computer.

CSV export is free up to 500 rows per table; the Pro license removes the limit and lets you choose the separator yourself. Everything runs locally in your browser.

Summary