SQL INSERT Generator

Paste rows with a header line, or pick a CSV, TSV or JSON file. Choose your database and table, and copy the INSERT statements.

How it works

The header line becomes the column list, and each row after it becomes one set of values. JSON works the same way: each key of each object becomes a column.

Quoting follows the database you pick. Names are quoted with double quotes for PostgreSQL and SQLite, backticks for MySQL, and square brackets for SQL Server. A single quote inside a value is doubled, and MySQL also gets its backslashes doubled, because MySQL reads a backslash as an escape.

The statements are written in this browser tab. Your rows are not uploaded.

How to use it

  1. 1 Paste your rows, or pick a CSV, TSV or JSON file. Cells copied from a spreadsheet paste as TSV.
  2. 2 Pick the database and type the table name.
  3. 3 Choose how many rows go in each INSERT, and how empty cells and numbers are treated.
  4. 4 Copy the SQL or download it as inserts.sql, then run it in your database client.

Good to know

  • Batching rows makes a large import much faster than one INSERT per row. One INSERT per row is easier to debug when a single row fails.
  • SQL Server allows at most 1,000 rows in one INSERT ... VALUES, so larger batches are cut to 1,000 for it.
  • PostgreSQL treats a quoted name as case-sensitive. If your table has a column email, a header of Email will not match it.
  • Leading zeros are kept: a cell such as 02139 stays quoted text, so a ZIP code or phone number is not turned into a number.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Loading a small CSV of customers into four different databases

Say you have a CSV export with a header line id,name,email,joined,active and three rows. One of the names is Ann O'Neil, and one customer has no email. You want these rows in a table called people. The SQL looks simple, but each of those details can break it, and each database breaks it in a slightly different way.

Start with the apostrophe. In SQL a string is wrapped in single quotes, so the apostrophe in O'Neil would end the string early and leave a syntax error, or worse, valid SQL that does something else. The standard fix, used by every database here, is to double the quote: 'Ann O''Neil'. The generator does that for every value. For MySQL it also doubles each backslash, because MySQL reads \n inside a string as a newline unless the server runs with NO_BACKSLASH_ESCAPES. A Windows path such as C:\new would otherwise arrive with a line break in it.

Next, the missing email. In the CSV it is an empty cell, and an empty cell could mean an empty string or no value at all. With Empty cells become NULL ticked, the generator writes NULL, which is usually what you want for an optional column. The id column is a plain number, so with Plain numbers stay unquoted ticked it is written as 1, not '1'. The active column holds the words true and false. They stay quoted text, because the tool does not guess types beyond numbers. PostgreSQL will accept 'true' for a boolean column, and other databases may need 1 and 0 in the CSV.

Then pick the database. For PostgreSQL the statement starts INSERT INTO "people" ("id", "name", "email", "joined", "active") VALUES, followed by one line per row. For MySQL the names use backticks, for SQL Server square brackets, and SQLite takes double quotes like PostgreSQL. With 100 rows per INSERT, all three rows go into one statement, which is faster to run than three. For SQL Server, values with characters outside plain ASCII get an N prefix, as in N'Zoë', so they are stored as Unicode.

There are limits to keep in mind. The generator does not create the table or check that the columns exist, and it does not convert dates: 2024-03-15 is sent as a string, which PostgreSQL, MySQL and SQL Server cast to a date column on insert. Very large batches can pass a server limit, such as MySQL’s max_allowed_packet, so lower the statement size if an import is rejected. Excel files are not read directly; open the sheet, copy the cells and paste them here as TSV.

Frequently asked questions

Why are the column names in quotes?

So that names with spaces, capital letters or reserved words such as order or group still work. The quotes differ by database, which is why you pick one. The catch is case: in PostgreSQL, "Email" and email are different columns, so make the header match how the table was created.

How are empty cells and numbers handled?

A CSV cell is just text. With Empty cells become NULL ticked, an empty cell is written as NULL. With Plain numbers stay unquoted ticked, a cell such as 42 or -3.5 is written without quotes. Untick either to keep everything as quoted text. JSON keeps its own types, so these options do not apply to it.

Why does MySQL get different escaping?

By default MySQL treats a backslash inside a string as the start of an escape, so C:\temp would lose its backslash and \t would become a tab. The generator doubles every backslash for MySQL. PostgreSQL, SQLite and SQL Server treat a backslash as an ordinary character, so it is left alone for them.

Does it create the table too?

No. It writes INSERT statements only. The table must already exist with matching column names.

Is my data uploaded?

No. The rows are read and the SQL is written in this browser tab. Nothing is sent to a server.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.