HTML Table to SQL Converter

Convert HTML tables into SQL CREATE TABLE and INSERT, UPSERT, MERGE, or COPY statements with dialect-specific output.

HTML Input

Optional URL import

Fetch HTML through the server proxy only when you explicitly submit a URL. Default conversion stays 100% client-side.

Conversion options

All conversion runs locally in your browser. Your HTML never leaves your device unless you explicitly use optional URL import on the page settings.

SQL Output

What is HTML table to SQL conversion?

HTML table to SQL conversion extracts tabular data from web pages, email templates, documentation, and exported reports, then generates database-ready SQL. This is useful when you have table markup from a CMS, wiki, or spreadsheet export and need to seed a database or migrate data into PostgreSQL, MySQL, or SQL Server.

How to use

  1. Paste HTML containing a table, upload an .html file, or optionally fetch a public URL.
  2. Select the target table if multiple tables are present.
  3. Choose SQL dialect, output mode, and table name options.
  4. Review schema inference, row preview, and generated SQL.
  5. Copy or download the SQL and run it in your database client.

Output modes

  • Multi-row INSERT — Batched INSERT statements for fast bulk loading
  • Single-row INSERT — One INSERT per row for debugging or partial imports
  • UPSERT / MERGE / REPLACE — Idempotent imports when a primary key is defined
  • PostgreSQL COPY — Tab-delimited COPY format for high-throughput PostgreSQL loads

Related tools

Frequently Asked Questions

What SQL does this tool generate?

It generates CREATE TABLE statements from inferred column types plus data statements such as multi-row INSERT, single-row INSERT, MySQL REPLACE, UPSERT (MySQL/MariaDB and PostgreSQL), SQL Server MERGE, or PostgreSQL COPY.

Which SQL dialects are supported?

PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, and ANSI SQL. Dialect selection affects identifier quoting, boolean literals, and UPSERT/MERGE syntax.

How are HTML table headers detected?

You can use thead cells, the first data row, or generated column names (col1, col2, …). Headers are normalized to snake_case by default.

Does this handle merged cells (rowspan/colspan)?

Yes. Merged cells are expanded into a rectangular grid so each row has consistent column values before SQL generation.

Can I convert multiple tables in one HTML document?

Yes. When multiple tables are detected, use the table picker to choose which one to convert. Each table is inspected separately.

Does this execute SQL against my database?

No. The tool only generates SQL text locally in your browser. Copy the output and run it in your own database client.

Is my HTML uploaded anywhere?

No. Parsing and SQL generation run locally in your browser. Optional URL import uses a server proxy only when you explicitly fetch a page URL.

What is the inverse of this tool?

Use the SQL to HTML Table Converter to turn SQL INSERT statements or query results back into HTML tables with live preview.

Can I add a synthetic primary key?

Yes. Enable “Add synthetic primary key” to append an auto-increment-style id column, useful when the HTML table has no natural key.

What row limits should I expect?

Small and medium tables convert instantly in the main thread. Large HTML documents use a Web Worker. Very large tables (tens of thousands of rows) may be slow depending on your device.

How are data types inferred?

Cell values are parsed as numbers, booleans, dates, or text when “Infer data types” is enabled. Empty cells can optionally become NULL.

Can I export only CREATE TABLE or only INSERT statements?

Yes. Use the CREATE only and INSERT only tabs in the SQL output panel, or toggle include options in conversion settings.