Turn a CSV file into a CREATE TABLE and INSERT statements, with column types worked out
Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 17 Oct 2026.Loading a spreadsheet export into a database without an import wizard takes a CREATE TABLE and one INSERT per row. Paste the CSV or open the file: the header row becomes the column names, empty cells become NULL, numbers, true and false and dates get proper column types, and codes with leading zeros such as 00501 stay text. Rows are batched 100 to a statement by default.
Paste or type your input.
Choose the options you need.
Press Ctrl+Enter, then copy or download.
Seeding a test database, loading an API response for analysis or moving a spreadsheet into a table all start with the same chore: writing a CREATE TABLE and a pile of INSERT statements. This page writes both from the data itself.
Column types are worked out from the values.
How it was checked. The output for 15 test cases, covering quotes, backslashes, emoji, reserved names, nested JSON, nulls, big integers and timestamps, was run in PostgreSQL 17 and SQLite 3.35, and the rows each engine read back equal the input. Nothing you paste leaves your browser. To go the other way, from INSERT statements back to JSON, use SQL to JSON.
The rest of the article, and all 6 questions about JSON to SQL Converter, are on the JSON to SQL Converter page.
Paste the JSON array here, choose your database and copy the script: a CREATE TABLE with a column per key, then INSERT statements with every value escaped. Run the script in psql, the MySQL client, sqlite3 or SQL Server Management Studio. Nested objects and arrays go into a JSON or text column.
SQL Server allows 1,000 rows in one VALUES list and returns error 10738 beyond that. PostgreSQL, MySQL and SQLite have no fixed row limit, but very long statements hit packet or memory limits, so 100 to 1,000 rows per statement is a safe choice. Batches here default to 100 rows.
Yes. Paste CSV or TSV with a header row instead of JSON and the delimiter is detected. Empty cells become NULL, numbers and true or false get typed columns, and values with leading zeros, such as ZIP code 00501, stay text so the zeros are kept.
No. Reading the JSON or CSV, working out the column types and writing the SQL all happen in your browser, and nothing is sent to a server or stored. The file you download is created on your device as well.
Rates and rules change; check the source before you rely on a figure.
Still stuck? Ask about JSON to SQL Converter and anybody who knows can answer. No account needed.
On the related tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · Query String Parser – Split a URL query string into a table of decoded parameters.