Convert CSV to SQL INSERT Statements

Paste CSV data, or drop a .csv file, and get ready-to-run SQL INSERT statements for the database of your choice. Nothing is sent anywhere.

Convert CSV to SQL INSERT Statements

Drop your CSV file here

Up to 20MB per file. Stays on this device.

Nothing is sent anywhere. Turn off your Wi-Fi and this page still works - try it.

How it works

  1. Drop or choose a .csv file, or paste CSV data directly into the text box. The first row is treated as column names.
  2. A ready-to-run INSERT statement renders immediately, with each column typed automatically: a column where every value looks like a plain number is inserted unquoted, everything else is a quoted, properly escaped string.
  3. Set the table name, pick MySQL, PostgreSQL, SQL Server, or Oracle for correct identifier quoting, and choose one batched statement or one INSERT per row. Copy or download the SQL you need.
Example output

Input

id,name,price
1,Widget,9.99
2,Gadget,14.50

Output

INSERT INTO `products` (`id`, `name`, `price`) VALUES
  (1, 'Widget', 9.99),
  (2, 'Gadget', 14.50);

Two rows of product data, converted into a single batched INSERT statement for MySQL.

Frequently asked questions

Is my CSV sent anywhere?

No. Pasted CSV and uploaded files are both read and converted entirely on your device, and nothing is sent to a server. Turn off your Wi-Fi after the page loads and it still works. This page loads 10KB of JavaScript, gzipped - about what your browser's network tab will show for this page's own scripts.

How does this decide whether a column should be quoted as text or left as a number?

Every value in a column is checked: only if every value in that column looks like a plain integer or decimal number (an optional minus sign, digits, an optional decimal point and more digits) is the whole column treated as numeric and left unquoted. A single non-numeric-looking value anywhere in the column - even a leading-zero code like 0042 that some systems use for IDs - keeps the entire column quoted as text, since a wrongly-unquoted value would produce invalid or silently wrong SQL.

What happens to an empty cell?

It becomes NULL (unquoted, the standard SQL way to represent a missing value) regardless of what type the rest of that column is.

What does the dialect selector actually change?

Only how table and column names are quoted: backticks for MySQL, double quotes for PostgreSQL and Oracle, square brackets for SQL Server. Value literals - strings, numbers, and NULL - are formatted identically across all four, since that part of SQL syntax is shared by every one of them.

What’s the difference between one batched statement and one INSERT per row?

A single batched statement (INSERT INTO t (...) VALUES (...), (...), (...);) is faster for a database to execute and is the default. One INSERT per row generates a separate statement for every row instead - useful if you need to run them individually, log each one, or paste them into a tool that only accepts one statement at a time.

Files are processed locally in your browser and never uploaded. Read more on the privacy page.