HTML Table to CSV
Pull the data out of an HTML <table> and get clean CSV.
Was this tool helpful?
Thanks for the feedback!
Paste HTML that contains a table and this tool reads its rows and cells into CSV, ready for Excel, Google Sheets or a script. It suits anyone who needs data from a web page, a saved report or an email template in a spreadsheet without retyping it or fighting messy copy-and-paste formatting.
Getting the HTML of a table
The input must be HTML markup, not the visible text of the page. The most reliable way to get it:
- Open the page in Chrome, Edge or Firefox, right-click inside the table and choose Inspect.
- In the Elements panel, click the line that starts with
<table(move up from the highlighted cell if needed). - Right-click it and choose Copy › Copy outerHTML (in Firefox, Copy › Outer HTML).
- Paste into the input box and click Extract CSV.
You can also paste a whole page's source. The tool uses the first <table> it finds, so trim the HTML down if the table you want is not the first one.
Example
Input:
<table>
<tr><th>Name</th><th>City</th></tr>
<tr><td>Asef</td><td>Mumbai,
MH</td></tr>
<tr><td>Riya</td><td><a href="/pune">Pune</a></td></tr>
</table>
Output:
Name,City Asef,"Mumbai, MH" Riya,Pune
The line break and extra spaces inside "Mumbai, MH" were collapsed to a single space, the value was quoted because it contains a comma, and the link was reduced to its text. The Rows counter shows how many rows were extracted.
What is extracted and what is lost
- Header (
th) and data (td) cells are both read, row by row, whether or not the table usestheadandtbody. - Only text is kept: link addresses, images and their alt text, and all formatting are dropped.
- A
<br>inside a cell adds no space, so "Line one<br>Line two" becomes "Line oneLine two". Replace line-break tags with a space before converting if that matters. - Cells using
colspanorrowspancount as one cell, so later values in that row shift left. Fix the columns in your spreadsheet, or add empty cells to the HTML first. - A table nested inside another table is read together with its parent, which duplicates text. Copy the inner table on its own instead.
- Rows hidden with CSS are still included, because the tool reads the markup, not what is displayed.
Where the data goes next
Save the result as a .csv file or paste it into a sheet. Turn it into a proper workbook with the CSV to Excel Converter, or rebuild a cleaner table with CSV to HTML Table. Before reusing data from someone else's website, check that its terms allow it. The HTML is parsed by your own browser, and nothing you paste is sent to a server.