CSV to SQL

Turn a CSV File into INSERT Statements.

Loading…

You have a spreadsheet export and a database table to fill. Import wizards differ by tool and often choke on quotes or encodings. A plain SQL script runs anywhere.

The first row gives the column names. Column types are guessed from the data: whole numbers become INTEGER, decimals REAL, dates in YYYY-MM-DD form DATE, the rest TEXT. Empty cells become NULL, and quotes in the data are escaped.

How to use the CSV to SQL tool

  1. Paste CSV or open a file.
  2. Enter the table name and pick your database.
  3. Copy the SQL or download a .sql file.
  • Seeding a development or test database
  • Loading a lookup table from a spreadsheet
  • Moving data between systems that share nothing but SQL

Tips for the best result

  • One INSERT with many rows loads much faster than thousands of single statements.
  • Check the guessed types. A postcode column of digits is typed INTEGER and would lose leading zeros.

Quick facts

PriceFree
Works withCSV → SQL
Where it runsIn your browser, on your device
AccountNot needed

Frequently asked questions

Which databases does the output work with?

MySQL and MariaDB, PostgreSQL, SQLite and SQL Server. The setting changes how names are quoted.

How large a file can it handle?

Tens of thousands of rows are fine. Very large files are better loaded with the bulk import of your database.

Are semicolon and tab separated files supported?

Yes. The separator is detected.

Does it add a primary key?

No. Add one to the CREATE TABLE statement if you need it.