Skip to content

CSV to SQL INSERT generator

Turn CSV rows into ready-to-run SQL INSERT statements for any database.

Input
Output

CSV to SQL INSERT generator

Paste a CSV export and get back SQL INSERT statements you can run against MySQL, PostgreSQL, SQLite or SQL Server. It is the quickest way to seed a table from a spreadsheet, load fixture data for tests, or move a client's export into a real database without opening an import wizard. Set the table name, paste the rows, and copy the statements straight into your query tool.

The parser follows RFC 4180, so a field wrapped in double quotes may contain the delimiter, doubled "" quotes and even line breaks without breaking a row. Values are quoted the way SQL expects: whole numbers and decimals stay unquoted, an empty cell becomes NULL, and everything else is wrapped in single quotes with any apostrophe doubled — so a name like O'Brien is escaped correctly instead of ending the string early. Because the values are read as text, leading zeros in postcodes and product codes are preserved.

"First row is column names" uses your header for the column list; switch it off and the columns become col1, col2 and so on. Choose the delimiter that matches your file — comma, semicolon (common in European exports) or tab. Turn on "Combine into one multi-row INSERT" and every row is batched into a single INSERT INTO t (…) VALUES (…),(…),(…); statement, which loads far faster than one statement per row on large imports.

Everything runs in your browser and nothing is uploaded, which matters when the export holds customer records or internal data. Copy the SQL, download it as a .txt file, or send the result to another tool to keep working. Review the generated statements before running them on a production database.

FAQ

Which SQL databases does the output work with?
The statements use standard INSERT INTO … VALUES syntax, which MySQL, PostgreSQL, SQLite, MariaDB and SQL Server all accept. Single quotes are escaped by doubling them, the portable form every major engine understands.
How are numbers, text and empty cells quoted?
Whole numbers and decimals are left unquoted, empty cells become NULL, and every other value is wrapped in single quotes with embedded apostrophes doubled. A value like 007 that you want kept as text stays a string only if it isn't a plain number.
What does the multi-row option do?
Instead of one INSERT per row, it emits a single statement with many VALUES tuples: INSERT INTO t (…) VALUES (…),(…),(…);. That is faster to run for large imports, though very long batches can hit a database's statement size limit.
Can I use my own table and column names?
Yes. Type the table name in the field, and the column list comes from your header row. Turn the header option off if your CSV has no header and the columns become col1, col2 and so on.
Is my data uploaded anywhere?
No. The CSV is parsed and the SQL is built entirely in your browser, with no server processing. Your database rows and customer data never leave your device.