HTML Table to CSV Converter

Paste a table copied from a web page (or its HTML), pick the table and get clean CSV with merged cells expanded.

CSV output

Why convert an HTML table to CSV

Statistics pages, documentation, admin dashboards and Wikipedia articles often show data in HTML tables. Copying them straight into a spreadsheet tends to bring along formatting, links and merged cells that break sorting and formulas. Converting the table to CSV first gives you plain rows and columns that Excel, Google Sheets, pandas or a database import can handle reliably.

The tricky parts are tables with merged header cells (colspan and rowspan), pages with several tables, and tables nested inside other tables for layout. This converter deals with each of these explicitly instead of simply reading every<td> it finds.

How to use it

  1. On the web page, select the table with your mouse and copy it. Click into HTML input and paste: the tool picks up the table's HTML from the clipboard. Alternatively paste HTML source you copied from your editor or from the browser's Inspect panel.
  2. If more than one table was found, choose it in the Table list (each entry shows its caption or first headers and its size).
  3. Choose the Delimiter and how Merged cells should be filled.
  4. Check the Preview under the tool, then click Copy CSV or Download .csv.

Worked example

The built-in example has a two-row header in which "Region" spans two rows and "Sales" spans two columns:

<thead>
  <tr><th rowspan="2">Region</th><th colspan="2">Sales (k$)</th></tr>
  <tr><th>Q1</th><th>Q2</th></tr>
</thead>
<tbody>
  <tr><td>North</td><td>120</td><td>135</td></tr>
  <tr><td>South, coastal</td><td>98</td><td>104</td></tr>
</tbody>
<tfoot>
  <tr><td>Total</td><td>218</td><td>239</td></tr>
</tfoot>

With the default options (comma, "Repeat value") the CSV is:

Region,Sales (k$),Sales (k$)
Region,Q1,Q2
North,120,135
"South, coastal",98,104
Total,218,239

Every row has three columns, so the file opens correctly in any spreadsheet. The value containing a comma is quoted automatically. With "First cell only" the covered cells stay empty instead (Region,Sales (k$), and ,Q1,Q2), which is closer to how the table looks on screen.

Options explained

  • Merged cells — "Repeat value" is best for analysis (every row is self-contained); "First cell only" keeps the visual layout.
  • Keep line breaks inside cells — <br> and paragraphs inside a cell become line breaks in a quoted CSV field. Off: all whitespace is collapsed to single spaces.
  • Escape formulas — guards against CSV formula injection from untrusted pages.
  • Add UTF-8 BOM — makes Excel on Windows show accented characters correctly; turn it off for files read by scripts.

Limitations

  • Only text is exported: links, images and formatting are dropped (image alt text is not included).
  • Tables that a site builds with JavaScript after the page loads are only available if you copy them from the rendered page, not from the raw page source.
  • Grids drawn with <div> elements instead of a real <table> are not detected.
  • Input is limited to 5 MB of HTML; a table that would expand to more than 2 million cells is rejected.

Tips

  • A two-row header usually needs to be merged into one row of column names before importing; edit the first lines of the CSV or use "First cell only" and fill them in.
  • Turn the CSV into JSON with the CSV to JSON converter, into INSERT statements with CSV to SQL, or into a workbook with CSV to Excel.

Frequently Asked Questions

How do I get a table from a website into this tool?

Select the table on the web page, copy it (Ctrl+C / Cmd+C) and paste it into the HTML input: the tool reads the HTML your browser puts on the clipboard. You can also right-click the table, choose Inspect, copy the <table> element's outer HTML and paste that.

Does it handle merged cells (colspan and rowspan)?

Yes. Merged cells are expanded into a regular grid so every row has the same number of columns. "Repeat value" copies the merged text into every covered cell; "First cell only" leaves the covered cells empty.

What if the HTML contains several tables?

Every <table> is listed in the Table selector with its caption or first header cells and its size, so you can pick the one to convert. Tables nested inside another table are marked as nested and their rows are not mixed into the outer table.

Are header cells (<th>) included?

Yes. Rows from <thead>, <tbody> and <tfoot> are exported in that order, and <th> and <td> cells are treated the same way. A <caption> is shown in the table picker but not written to the CSV.

Why do some cells start with an apostrophe?

With "Escape formulas" on, cells beginning with =, +, - or @ get a leading apostrophe so Excel or Google Sheets treat them as text instead of running them as formulas. Plain negative numbers are not changed.

Is my HTML sent to a server?

No. The HTML is parsed in your browser with DOMParser, which builds an inert document: scripts in the pasted HTML are not executed and nothing is uploaded.