Skip to content
Utilerio

Excel / CSV to SQL INSERT

Turn an Excel sheet or CSV into batched SQL INSERT statements for Postgres, MySQL or SQL Server.

Rows are grouped into multi-row INSERT statements of this size.

SQL

The result will appear here.

Was this tool useful?

About this tool

Loading a spreadsheet of real-world data into a database usually means turning every row into an INSERT statement — tedious and error-prone by hand, especially once you account for NULL values, apostrophes in text, and each database's own quoting rules for identifiers.

How to use it

  1. Upload an Excel sheet or CSV file.
  2. Set the target table name and pick a dialect: PostgreSQL, MySQL or SQL Server — each quotes identifiers and strings slightly differently.
  3. Pick a batch size: rows are grouped into multi-row INSERT statements of that size, rather than one INSERT per row or one giant statement for the whole file.
  4. Copy the result or download it as a .sql file.

Examples

Two rows, PostgreSQL

id,name
1,"O'Brien"
2,Ada
INSERT INTO "my_table" ("id", "name") VALUES
(1, 'O''Brien'),
(2, 'Ada');

Common problems

A numeric-looking column got quoted as text.
The column type is inferred by checking every value in that column — if even one row has a non-numeric value (an empty placeholder like "N/A", for instance), the whole column falls back to text to avoid generating invalid numbers.
I need this in a different dialect after already generating it.
Switch the dialect selector — the output regenerates instantly using the same parsed rows, so there's no need to re-upload the file.

Frequently asked questions