HTML table to CSV — markup is not a spreadsheet, and layout does not survive
A vendor publishes a price page and you need the rows in a spreadsheet. Reading the markup gives you the cell text and nothing else: the table's structure — merged headers, spans, nested markup — is presentation, and a flat delimited file has no way to express it.
Cell formatting, colours, column widths and merged ranges are dropped; only stored values survive.
Processed on your device. Files aren’t sent anywhere.
Only the cell text travels
The reader takes each cell's text. Everything describing how the page looked stays behind.
- Text inside a cell is kept, including nested markup's text.
- Inspect punctuation and spacing in the extracted text before treating it as clean import data.
- Links contribute their text, not the destination.
- Scripts and styles contribute nothing.
- Tables in the document become sheets; sheet mode decides how many are written.
Rowspans and colspans have no counterpart
A header cell spanning three columns supplies one label where the data rows have three cells. CSV cannot record that a label covered several columns, so the shape has to be repaired afterwards.
| Markup | In the CSV | Consequence |
|---|---|---|
| Header labelled Region spanning three columns | one field | fewer labels than data cells |
| Cell labelled Total spanning two rows | one field in the first row | second row starts one cell early |
| A cell displaying $12 | $12 | currency arrives as text |
| A cell displaying an encoded ampersand | & | entity decoded |
Entities and formatting inside cells
Entities are decoded, so an ampersand or a non-breaking space arrives as the character it represents. Currency symbols, bold text and footnote markers remain part of the text, which is why a price column usually needs a cleanup pass before it can be summed.
What the CSV keeps and drops
The output is UTF-8 with a byte order mark and CRLF line endings, so spreadsheet software reads accented characters correctly. Kept: cell text, decoded entities, row order. Dropped: spans, styling, links, captions, nested tables as structure.
A copied price table may contain currency signs, footnote markers and thousands separators inside the displayed cell text. Those characters can be meaningful to a reader while confusing a numeric importer. Extraction does not decide your data schema. Check one price with punctuation and one empty price before importing the complete file; keep descriptive notes out of arithmetic columns in the receiving system.
Checking the extracted rows
Because layout is not reconstructed, the row shape is the thing to verify.
- Convert the .html file and download the CSV.
- Open it in a text editor so nothing is retyped.
- Compare the field count of the header row with the data rows.
- Repair any row that a span shifted.
- Strip currency symbols before importing numbers.