RunTheTests
/

HTML Table to CSV

Pull a table out of HTML and get clean CSV back.

What you paste

Parsed in your browser — never uploaded

How this reads your output

Rows and cells are pulled from the first table element in what you paste, tags inside cells are stripped, and HTML entities are decoded back to the characters they represent. The result is re-quoted for CSV, so a cell containing a comma or a quotation mark comes out correctly instead of splitting the row. Merged cells and rows with an unexpected column count are counted and reported, because both produce data that looks valid and is not.

What the results mean

Merged cells
Cells with a colspan or rowspan. CSV has no equivalent, so a merge becomes one value and the columns after it shift left in that row.
Rows with a different column count
Usually a section heading spanning the full width, or a footer row with a different shape. Both need checking by hand.
Tables found
How many tables were in the markup. Only the first is converted, so paste just the one you want if there are several.

Common problems and fixes

The data is shifted by one column on some rows
Merged cells, almost certainly. Look at the original table for cells spanning more than one column, since each one leaves a hole the conversion cannot fill. The fix is to add the repeated value back by hand in the affected rows, which is quick once you know where to look.
Nothing is found in markup that clearly has a table
Check that you pasted the opening and closing table tags rather than just the rows. If the page builds its table with script, copy the rendered markup from the browser inspector instead of the page source, because the server response contains no table at all.

Frequently asked questions

Can I just copy a table into a spreadsheet?

Often yes, and it is worth trying first. Selecting a rendered table in a browser and pasting it into a spreadsheet usually preserves the cell structure. This tool is for when that fails, when you only have the markup, or when you want CSV rather than a spreadsheet.

Why are numbers coming through as text?

CSV carries no types, so everything is text until something interprets it. Spreadsheets guess on import, and their guesses cause the usual damage: long identifiers turned into scientific notation and values that look like dates being converted. Import as text and convert deliberately where it matters.

What happens to links inside cells?

The visible text is kept and the URL is discarded, since a cell holds one value. If you need both, convert the markup to Markdown instead, which preserves links inline.

Put this on your own site

Free to embed, no attribution required beyond the source link the frame carries itself. It runs entirely in your visitor's browser, sets no cookies and loads no third-party script.

Embed code
<iframe src="https://runthetests.com/embed/html-table-to-csv/" width="100%" height="720" style="border:1px solid #e5e5e5;border-radius:8px" title="HTML Table to CSV" loading="lazy"></iframe>

Preview it at https://runthetests.com/embed/html-table-to-csv/. Embedded pages are marked noindex, so yours stays the canonical copy — not this one.

More in Data