ModernCalcs

HTML Table to CSV

Name,Age,City
Alice,30,New York
Bob,25,"San Francisco, CA"
Charlie,35,London

Extracts all <tr> rows from the HTML. Both <th> and <td> cells are included. HTML entities and inline tags are stripped.

HTML Table to CSV: Extract Web Table Data Without Copy-Paste Mess

Web pages often contain tables full of useful data — pricing, statistics, schedules, comparison grids. Copy-pasting into Excel works sometimes, but preserving structure is unreliable. Paste the raw HTML and this tool extracts every row as a properly formatted CSV line, stripping tags, decoding HTML entities, and applying RFC 4180 quoting where needed.

Formula
HTML: <tr><td>Alice</td><td>30</td><td>New York, NY</td></tr> CSV: Alice,30,"New York, NY" Rule: each <tr> → one CSV line Rule: each <td>/<th> → one CSV field Rule: strip tags, decode &amp; &lt; &gt; &quot; &nbsp;

All rows from all tables in the HTML are extracted in order. Both <th> and <td> become CSV fields.

How to Get HTML from a Web Page

To get table HTML from a web page: right-click the table → Inspect Element → find the

tag → right-click → Copy → Copy outer HTML. Then paste the copied HTML into this tool. Alternatively, use 'View Source' (Ctrl+U) and find the table section manually.

Limitations: Merged Cells

colspan and rowspan attributes create merged cells that span multiple columns or rows. This extractor treats each

/ as one field — it does not expand spans. A cell with colspan=3 still produces one field, not three. For tables with complex merging, export via the browser's built-in copy → paste into Excel, which handles span attributes.

Use Cases

Common uses include extracting financial data from HTML reports, scraping comparison tables from documentation pages, converting API response tables to CSV for import, pulling schedule data from HTML emails, and extracting Wikipedia tables for data analysis.

Practical Examples

Extracting a Wikipedia Table

Wikipedia data tables are straightforward HTML tables that convert cleanly.

  • 1.Open the Wikipedia article
  • 2.Right-click the table → Inspect → find the tag
  • 3.Right-click the
  • → Copy outer HTML
  • 4.Paste here and copy the CSV output
  • What Gets Processed

    • All
    rows from all tables in the HTML
  • Both
  • header and data cells
  • HTML entity decoding (& < > "  )
  • Inline tags stripped (keeps text content)
  • Fields with commas wrapped in double quotes
  • Frequently Asked Questions

    What HTML table elements are supported?

    The converter processes

    , , , , , rows become the first CSV rows — they are not treated differently from body rows, so a elements, so you can paste a complete page or partial HTML fragment. All rows from all tables on the page will be extracted in document order. If you only want one table, paste just that table's HTML.

    , and elements. Both header cells () and data cells () are extracted as CSV fields.
    header row naturally becomes the CSV header line.

    How are HTML entities handled?

    Common HTML entities are decoded before output: & → &, < → <, > → >, " → ", ' → ',   → space. This ensures your CSV data is clean text rather than raw HTML entity codes.

    What happens with merged cells (colspan/rowspan)?

    Merged cells (colspan and rowspan attributes) are not expanded — each

    or element is extracted as one field regardless of span. If your table uses merged cells, the CSV row widths may not align. For accurate extraction of tables with spans, use a tool that parses the DOM, such as pasting the table into a spreadsheet first.

    Can I paste a full web page?

    Yes. The converter scans the entire HTML for