Skip to content

Convert HTML to CSV

Extract HTML tables into editable, importable CSV files with desktop tools, scripts, or online services.

Convert HTML files online

We don’t have a dedicated online converter for HTML to CSV yet, but you can convert HTML files online to these and more formats:

Want to convert HTML to CSV?

Let us know. We pick the conversions to add next by how many people ask for them.

How to convert html to csv file

A spreadsheet, database, or analytics system may require tabular data in CSV instead of a saved web page. Converting an HTML table makes its records easier to edit, import, archive, or process as a smaller plain-text file.

What the HTML format is

HTML (HyperText Markup Language) is the document format used for web pages and locally saved web documents. Elements such as headings, paragraphs, links, lists, and tables define the document structure; CSS controls presentation, while scripts can generate or modify content.

Browsers and office, reporting, content-management, and web applications commonly create .html and .htm files. An HTML file may contain several tables alongside navigation, advertisements, images, forms, and dynamically loaded data. Only the table data normally belongs in a CSV export.

What the CSV format is

CSV (comma-separated values) is a plain-text tabular format. Each record usually occupies one line, and fields are separated by commas. A field containing a comma, quotation mark, or line break is enclosed in double quotation marks; a quotation mark inside a quoted field is represented by two quotation marks.

CSV files are supported by Microsoft Excel, LibreOffice Calc, Google Sheets, databases, statistical software, and import APIs. CSV is smaller and easier to process than HTML, but it does not preserve formatting, page layout, images, formulas, CSS, or most document structure. A URL may be retained as text only if the source table or extractor provides it as a cell value.

Convert with Microsoft Excel

  1. Open Excel and choose File → Open. Select the HTML file; choose All Files if it is not shown.
  2. Review the imported content. If the page contains several tables, copy the required table to a new worksheet. Remove navigation text, headings, footers, merged cells, and unrelated columns.
  3. Choose File → Save As and select CSV UTF-8 (Comma delimited) (*.csv).
  4. Accept the warning that only the active worksheet will be saved. Export each unrelated table to a separate CSV file.

Excel is suitable for a small number of ordinary HTML tables because it allows visual cleanup before export. It can also change values such as leading-zero identifiers, dates, and long numbers, so format those columns as text before saving or verify the resulting CSV.

Convert with LibreOffice Calc

  1. Open the HTML file in LibreOffice Calc and select the table or sheet containing the required records.
  2. Choose File → Save As, select Text CSV (.csv), and enable Edit filter settings if that option is available.
  3. In the export dialog, set the character set to UTF-8, the field separator to comma, and the text delimiter to double quotation marks.
  4. Use Save cell contents as shown only when the displayed values, rather than the underlying cell values, are required.

LibreOffice is a free desktop alternative. Its HTML importer may need correction when the source uses nested tables, rowspan, colspan, or several unrelated tables.

Extract tables with Python

For repeatable conversion, install pandas and an HTML parser:

python -m pip install pandas lxml

Write every detected HTML table to a separate CSV file:

import pandas as pd

tables = pd.read_html("input.html")
for number, table in enumerate(tables, start=1):
    table.to_csv(f"table-{number}.csv", index=False, encoding="utf-8-sig")

To export only the first detected table:

import pandas as pd

pd.read_html("input.html")[0].to_csv("output.csv", index=False, encoding="utf-8-sig")

read_html() extracts actual <table> elements. It does not run page JavaScript, authenticate to a site, follow pagination, or recover content loaded after the saved HTML was created. For dynamic pages, use the site's own export, obtain the underlying API response, or save the fully rendered table before extraction. Inspect tables with multi-level headers and flatten or rename those headers before writing the final CSV.

Use an online converter

For a non-confidential, self-contained file, upload the HTML to a reputable service such as Convertio or Zamzar, select CSV as the output format if HTML-to-CSV is currently offered, start the conversion, and download the result. Service support and output behavior can change, and many online converters handle only simple tables rather than JavaScript-rendered pages.

Do not upload credentials, personal records, customer data, unpublished reports, or other restricted HTML unless the provider's retention, deletion, encryption, and processing terms are acceptable. Desktop software or a local Python script is preferable for sensitive data.

Check the converted CSV

  • Multiple tables: CSV has no worksheets or internal table container. Export unrelated tables separately, or combine them only when their columns describe the same record type.
  • Spans and headers: HTML cells using rowspan or colspan can create blank, repeated, or shifted fields. Check column names and the first and last records manually.
  • Encoding: Use UTF-8. UTF-8 with BOM, written by utf-8-sig, can improve automatic detection when the file is opened directly in older Windows versions of Excel. Check accented and non-Latin characters.
  • Delimiters: CSV is a convention rather than a single fully standardized dialect. Regional spreadsheet settings may expect semicolons. If all fields appear in one column, import the file and explicitly select comma as the delimiter.
  • Data types: Spreadsheet programs may remove leading zeros, round long identifiers, reinterpret dates, or display values in scientific notation. Import postal codes, account numbers, product IDs, and similar fields as text.
  • Line breaks and quotes: Valid CSV can contain quoted fields with embedded commas and line breaks. Test the output in the target application instead of judging validity from a plain-text preview.
  • Missing dynamic data: A downloaded HTML file may contain only an initial page shell. Data loaded through JavaScript, login sessions, infinite scrolling, or pagination may never reach the converter.

HTML vs CSV: format comparison

How the HTML and CSV formats compare on the properties that matter most for this conversion.

Comparison of the HTML and CSV file formats
Property .HTML HyperText Markup Language .CSV Comma-Separated Values
Open standard Yes Yes
Compression Uncompressed Uncompressed
Typical file size Small Small
Opens in a web browser Yes, natively Yes, natively
Further editing Easy Easy
Metadata support Basic Basic
Plain-text readable Yes Yes
Best used for Web publishing Data exchange
Introduced 1993 —
Developer W3C / WHATWG —
MIME type text/html text/csv

Information about file extensions and file types is provided by File-Extensions.org

Already downloaded

This file has already been downloaded. For your privacy it was deleted from our server right after the download, so it cannot be downloaded again. To get it once more, convert the file again.