CSV to SQL Converter

Turn a spreadsheet export into ready-to-run SQL: a typed CREATE TABLE and batched INSERT statements, with quoted-field parsing and single quotes escaped for you.

Paste a CSV and this converter reads its columns, works out each one's SQL type, and writes a matching CREATE TABLE plus the INSERT statements to fill it. It scans every value in a column to decide whether it is an INTEGER, DECIMAL, BOOLEAN, DATE or a VARCHAR sized to the longest entry, so you never hand-type the schema. Point it at a comma, tab, semicolon or pipe file, choose how empty cells and identifiers are handled, then copy the .sql or download it. Parsing and generation both happen in your browser.

CSV
SQL

5 columns · id INTEGER, name VARCHAR(11), active BOOLEAN, price DECIMAL, signed_up DATE · 3 rows · converted in your browser.

How it works

  1. 1

    Paste or upload the CSV

    Drop your rows into the left pane or upload a .csv or .tsv file, and pick the delimiter if it isn't a comma.

  2. 2

    Set the table options

    Name the table, mark whether the first row is a header, and choose how blank cells map (NULL or empty string) and whether identifiers are quoted.

  3. 3

    Copy the CREATE TABLE and INSERTs

    The right pane shows the inferred column types and the generated SQL. Copy it or download a .sql file to run against MySQL, Postgres or SQLite.

Instant & 100% private — nothing is uploaded

Everything runs locally in your browser. Your code, text and files are processed on your own device and are never sent to a server — so there are no upload waits, no size limits from us, and nothing is ever stored or logged.

Frequently asked questions

How do I convert a CSV to SQL INSERT statements?
Paste the rows and the tool writes both the table and the inserts. For the header id,name,active,price with a line 1,Ada,true,9.99 it produces CREATE TABLE my_table ("id" INTEGER NOT NULL, "name" VARCHAR(3) NOT NULL, "active" BOOLEAN NOT NULL, "price" DECIMAL NOT NULL); followed by INSERT INTO my_table ("id", "name", "active", "price") VALUES (1, 'Ada', TRUE, 9.99);.
How does it infer each column's SQL type from a CSV?
It reads every value in a column. Whole numbers become INTEGER (or BIGINT past about 2.1 billion), numbers with a decimal point become DECIMAL, true/false or yes/no columns become BOOLEAN, ISO dates like 2024-01-05 become DATE and dates with a time become TIMESTAMP. Everything else becomes a VARCHAR sized to the longest value, or TEXT once that passes 255 characters. Codes like 007 stay text so leading zeros survive.
Can I get one INSERT per row instead of a single batch?
Yes. Batch INSERT is on by default and emits one multi-row VALUES list, which loads fastest. Turn it off to get a separate INSERT statement for each row, which is easier to diff, re-order, or run a few lines at a time.
Does it handle commas, quotes and newlines inside CSV fields?
Yes. A quoted field such as "Smith, Alan" keeps its comma, a doubled quote ("") decodes to a literal quote, and a line break inside quotes stays part of the value. Single quotes in your data are doubled when written into SQL so O'Brien becomes 'O''Brien' and the statements stay valid.