Skip to content
ToolPlankDEV
Text Tools
100% In-Browser Execution

Updated:

HTML Table to CSV Converter

Use this html table to csv converter to turn a table from HTML code, or one copied from a web page, into CSV. Choose the table, handle merged cells, pick the separator and download a file that opens in Excel or Google Sheets. Nothing is uploaded.

Processing in browser...

Loading the tool. It runs entirely in your browser, so your data is never uploaded.

More free tools you may need next.

Quick Guide

How to use HTML Table to CSV

Simple step-by-step instructions to get the exact output you need.

  1. 01

    Paste the table

    Copy a table from a web page, Google Docs or Word and paste it into the box. Its table code comes along. You can also paste HTML source that contains a <table>. Press Example to load two small tables.

  2. 02

    Pick the table

    If the HTML holds more than one table, choose the one you want in the Table menu, or choose All tables. The preview below the result shows the first rows of the chosen table.

  3. 03

    Set the options

    Merged cells can repeat their value or leave the other cells empty. Choose a comma, semicolon or tab as the separator, decide what to do with line breaks inside cells, and remove footnote markers such as [1] if you do not want them.

  4. 04

    Copy or download the CSV

    Press Copy CSV, or Download to save table.csv. Turn on UTF-8 BOM for Excel if accents or symbols look wrong when you open the file in Excel.

How to Convert an HTML Table to CSV

To convert an HTML table to CSV, paste the table into the box above. The tool reads the rows and cells, joins the cells of each row with a separator and writes one line per row. Cells that contain the separator, a double quote or a line break are put in double quotes, as the CSV format asks. With the Example the first table gives:

Text
Name,Role,Notes
Ada Lovelace,Mathematician,"Wrote the first program, in 1843"
Linus,Engineer,Pipes | and more
Grace Hopper (admiral),Grace Hopper (admiral),"Line one
Line two"

The comma in the Notes cell would have split it into two columns, so that cell is quoted. The last cell holds a line break, so it is quoted too and stays one cell that spans two lines. The tool reads the text only. It does not run scripts that are inside the pasted HTML.

Copy a Table from a Web Page and Paste It Here

Select the table on the page, copy it and paste it into the box. Browsers put the table on the clipboard as HTML as well as plain text, and the tool takes the HTML version, so the structure is kept. If only plain text is on the clipboard and it has tabs between the cells, which is what a spreadsheet copy gives, the tool reads that as a table too.

To get a table from the page source instead, open the developer tools, copy the outer HTML of the <table> element and paste it. A whole page also works. The tool finds every table in it and ignores the rest of the page. If you have HTML that is not a table and you only want its text, use Remove HTML Tags.

Merged Cells: Colspan and Rowspan

A cell can span several columns (colspan) or rows (rowspan). CSV has no way to merge cells, so the tool has to fill the gap. Merged cells has two settings. Repeat the value copies the text into every cell the merged cell covered, which keeps each row complete and is best for sorting and filtering. Leave the others empty puts the text in the first cell only.

In the Example the last row has a cell that spans two columns. With Repeat the value you get Grace Hopper (admiral) in both columns, and with Leave the others empty the second one is blank. Rows that are shorter than the longest row are filled with empty cells, so every line has the same number of columns.

Open the CSV in Excel or Google Sheets

Download the file and open it in Excel, Google Sheets, LibreOffice or any other spreadsheet program. Google Sheets opens it from File, then Import. In Excel, double-clicking a .csv file usually works. Use Data, then From Text/CSV if you want to choose the separator and the encoding.

  • Everything ends up in one column: the program expects a different separator. Many European settings use a semicolon, so set Separator to Semicolon and convert again.
  • Accents or symbols look wrong in Excel: turn on UTF-8 BOM for Excel and download again. The BOM is a short marker at the start of the file that tells Excel the text is UTF-8.
  • Numbers lose leading zeros: spreadsheets treat a cell like 00123 as a number. Import the column as text.

The BOM is added to the downloaded file only. The text you copy has no BOM. To turn CSV back into table code, use CSV to HTML Table. If you need to go from CSV to a Markdown table afterwards, use CSV to Markdown, and for a spreadsheet from JSON there is JSON to Excel.

  • A <br> tag inside a cell becomes a line break in that cell. Keep leaves it inside the quotes. Turn into a space joins the lines, which is easier for tools that read one line per row.
  • A link keeps its text and drops the address. An image keeps its alt text. Bold, italic and other styling is dropped, and so are scripts and style blocks.
  • A table inside a cell is flattened into that cell as text, and is not listed as a separate table.
  • Remove [1] markers deletes references such as [1], [a], [note 2] and [citation needed], which are common in tables copied from encyclopedias. It leaves other square brackets alone.
  • Extra spaces and the line breaks of the HTML source are collapsed, and non-breaking spaces become normal spaces.

Text such as &amp; and &copy; in the HTML is decoded to the real characters. The tool knows the common named entities and all numeric ones. An unknown name is left as written.

Download a CSV from an HTML Table with JavaScript

If you only need this on a page you control, a few lines of JavaScript are enough. Run this in the browser console on a page with a table, and it saves the first table as table.csv:

JavaScript
const table = document.querySelector("table");
const rows = [...table.rows].map((row) =>
  [...row.cells].map((cell) => `"${cell.innerText.replace(/"/g, '""')}"`).join(",")
);
const link = document.createElement("a");
link.href = URL.createObjectURL(new Blob([rows.join("\n")], { type: "text/csv" }));
link.download = "table.csv";
link.click();

The snippet quotes every cell and ignores colspan and rowspan, so merged cells will leave gaps. This tool handles those cases, picks a table for you and works on HTML you paste, without running anything on the original page.

Limits and Privacy

The tool cannot fetch a web page by its address, because a browser tool is not allowed to read other sites. Copy the table or its HTML instead. It does not read .xlsx files, and it finds up to 200 tables in one paste. Input is limited to 2,000,000 characters.

Cells that start with =, +, - or @ are written as they are. If the source is not trusted, check the file before you open it in a spreadsheet, because a spreadsheet may treat such a cell as a formula. Respect the terms of the sites you copy data from.

The conversion runs in your browser. The HTML is not sent to a server and is not stored. See the Privacy Policy for details. To turn the same table into Markdown for a README or a wiki, use HTML Table to Markdown.

Frequently Asked Questions

Technical Q&A for HTML Table to CSV

Common questions about edge cases, character encoding, and privacy guarantees.

Paste the table or its HTML into the box, choose the table if there are several, and press Copy CSV or Download. Each row of the table becomes one line of the CSV.

Yes. Select the table, copy it and paste it into the box. The browser copies the table as HTML, and the tool reads the rows and cells from that.

CSV cannot merge cells, so the tool either repeats the value in every covered cell or fills only the first one and leaves the rest empty. You choose with Merged cells.

If everything lands in one column, set Separator to Semicolon and convert again, because many Excel settings expect a semicolon. You can also use Data, then From Text/CSV, and pick the separator there.

Excel may read the file in the wrong encoding. Turn on UTF-8 BOM for Excel and download the file again.

Map each row of table.rows to its cell texts, quote them, join with commas, put the lines in a Blob and click a download link. The snippet in the article does it in a few lines, but it ignores merged cells.

Yes. Choose All tables and the tool writes every table, with an empty line between them. To get one file per table, pick each table in turn and download it.

Turn on Remove [1] markers. It deletes references such as [1], [a], [note 2] and [citation needed] from every cell.

No. A browser tool cannot read other websites. Copy the table from the page, or copy the table's HTML from the developer tools, and paste it here.

No. The table is read and converted by code in your browser. Nothing is sent to a server or saved, and scripts in the pasted HTML are never run.