BackendBench
Coffee
Free tool

CSV / JSON to SQL INSERT

Paste a CSV or JSON array, name the table and get INSERT statements (and a CREATE TABLE) for your database.

SQL

Loading a spreadsheet into a database

Sooner or later you have a CSV export, a JSON array from an API or a column copied out of a spreadsheet, and you need it in a table: seed data for tests, a one-off migration, a bug reproduction. Importing tools exist, but a short, readable script of INSERT statements is portable, reviewable and works with every client.

Paste CSV (comma, semicolon, tab or pipe separated, with quoted fields and embedded line breaks) or a JSON array of objects, name the table and choose the dialect. The generator writes the statements with correct quoting for PostgreSQL, MySQL and MariaDB, Oracle, SQL Server or standard SQL: backtick, bracket or double-quote identifier quoting where needed, string escaping, boolean literals (TRUE or 1), multi-row VALUES lists and Oracle's INSERT ALL form. Tick "create table" to get a matching CREATE TABLE with column types inferred from the data.

Behaviours worth knowing

The conversion happens in your browser and the data is never uploaded. Review the output before running it against a real database, and wrap large loads in a transaction.

Frequently asked questions

How are quotes and special characters escaped?

Single quotes are doubled (O'Neil becomes 'O''Neil'), which works in every SQL dialect. MySQL also treats a backslash as an escape character by default, so backslashes are doubled for it. SQL Server gets an N prefix on text with non-ASCII characters.

How are empty cells treated?

Empty cells and the text NULL become SQL NULL. If you need empty strings, turn the type inference off and edit the data, or replace empty cells with a space before converting.

Why are some numbers quoted?

Values with leading zeros (zip codes, ids such as 01234) and very long numbers are kept as text, because converting them to numbers would change or lose digits.

Is it safe to run the generated SQL with user data?

The escaping is meant for loading your own files. For application code that handles user input, use parameterised queries or a batch API (JDBC PreparedStatement, JPA), never string-built SQL.

More tools you might need