Skip to content
hateitall

CSV to SQL

Load a spreadsheet export into a database table without writing a single INSERT by hand.

Processed locallyIn: CSV, TSVOut: SQL

Loading tool…

How to use csv to sql

  1. Paste CSV or open a .csv file; the delimiter is detected.

  2. Set the table name and pick your database.

  3. Choose rows per INSERT, CREATE TABLE, a transaction and how empty cells are written.

  4. Check the column types, then copy or download the .sql file.

What this tool does

  • Infers INTEGER, BIGINT, DECIMAL, BOOLEAN, DATE, TIMESTAMP and text columns from the values, and NOT NULL where no cell is empty.
  • Escapes quotes correctly for each database, including MySQL backslashes and N'' strings for SQL Server.
  • Multi-row INSERTs in batches you choose, capped at SQL Server's 1,000 row limit.
  • Quotes column names that are reserved words or contain spaces.
  • Keeps leading zeros: a column like 007 stays text.

How the result is verified

Every literal in the generated SQL is decoded again and compared with your CSV cell for cell, so quoting mistakes cannot slip through.

Frequently asked questions

How many rows can I put in one INSERT?

Most databases handle hundreds or thousands; 100 to 500 is a safe default. SQL Server allows at most 1,000 rows per VALUES list, and the tool caps it for you.

What if my CSV has no header row?

Turn off 'First row holds column names' and the columns are named column_1, column_2 and so on.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

JSON array of objects to INSERT statements and CREATE TABLE

JSON→ SQLLight on device

Batched INSERT statements from pasted CSV or JSON

CSV · JSON→ SQLLight on device

Readable SQL with clauses, joins and subqueries laid out

SQL→ SQLLight on device

Turn CSV rows into a JSON array of objects, with types and nesting

CSV · TSV→ JSONLight on device

Find ragged rows, quote errors and duplicate headers by line

CSV · TSV · Text→ CSVLight on device