Skip to content
Account

Convert an HTML table to SQL

1 credit per pageDeleted after 2 hAlso as Excel · CSV · JSON

Free account · 20 free credits. Sign up to run it.

Opening…

Drop your file here

or choose it from your device

HTML, HTM · up to 1 file per job

or paste it here (Ctrl+V)

Before and after

Markup a browser draws, and the statements that put it in a database.

The HTML
<thead><tr><th>Count</th><th>Blend</th><th>Rate/kg</th></tr></thead>
<tbody><tr><td>20s</td><td>100% cotton</td><td>268.00</td></tr>
</tbody>
SQL
CREATE TABLE "t0" ("count" text, "blend" text, "rate_kg" numeric);

INSERT INTO "t0" ("count","blend","rate_kg") VALUES
    ('20s', '100% cotton', 268.00);

What this tool does

This tool reads the table out of an HTML page and writes it as SQL: one CREATE TABLE for the grid and INSERT statements for the rows, ready to run against Postgres or SQLite. The structure comes straight from the markup, and column names come from the header row, cleaned into identifiers. A column becomes a number or a date only when every non-empty cell in it parses that way; a single cell that does not keeps the whole column as text, so a type is never guessed on a majority vote. Empty cells become NULL. Every identifier and every value is quoted, so nothing on the page can be read as SQL. Scripts and styling are ignored, and nothing is fetched from the internet.

The values in this file were read from your document by AI, and they can be wrong — check them against the original before you rely on them. Your document itself is not altered.

What happens to your file

Deleted from our servers after 2 hours. We do not train AI on your files, and the terms of our AI providers do not allow them to; they may keep request logs for up to 55 days, longer for a request they flag for abuse.

Uploads and outputs are deleted after 2 hours, whether or not you download them. Provider request logs are kept for at most 55 days. Details on the privacy page.

Questions

What happens to the file I upload?

It is deleted from our servers after two hours, whether or not you download the result, and it is not used to train anything. An HTML table is read from the markup on our own machines, so in the ordinary case nothing about it goes to an AI provider at all.

Can a value on the page break out and run as SQL?

That is the thing this exporter is built to prevent. Identifiers and literals are quoted, so an apostrophe or a semicolon in a cell is data and stays data. If a value cannot be quoted safely the export fails rather than emitting a statement we are not sure about.

Which dialect do I get?

PostgreSQL by default, with SQLite available. Pick the one you are actually going to run it against; the two differ in more than syntax.

Why is one of my number columns text?

Because at least one cell in it did not parse as a number — a footnote mark, a dash, a "n/a". A column is only narrowed when every non-empty cell fits, so you never get a column that is right for most rows and silently wrong for the rest.

Can I point it at a URL?

Not from this page. Fetching an arbitrary address from our servers is a security question before it is a feature. Save the page and upload it.

Extract tables from a PDF

Tables & text out of a document