CSV to SQL Converter
Turn CSV rows into SQL INSERT statements.
How to use
- 1 Enter the target table name.
- 2 Paste your CSV, with column headers in the first row.
- 3 The converter detects numbers, escapes quotes and NULLs blanks.
- 4 Copy the INSERT statements or download them as a .sql file.
About CSV to SQL Converter
The CSV to SQL converter turns a CSV export into ready-to-run INSERT statements for any SQL database.
The first row supplies the column names, and every following row becomes one INSERT INTO table (columns) VALUES (...); line.
Seeding a database, migrating a spreadsheet into a table, or building a quick fixture by hand is slow and error-prone, mostly because of escaping — a single apostrophe in a name like O'Brien will break the whole script if it is not handled.
This tool doubles embedded single quotes the way the SQL standard requires, so your statements are safe to paste straight into a client.
It also detects numeric values and emits them unquoted, leaves empty cells as NULL, and quotes any table or column identifier that contains spaces or special characters.
The CSV itself is parsed with a proper RFC 4180 reader, so quoted fields containing commas, quotes or embedded newlines are handled correctly rather than splitting in the wrong place.
You set the target table name once and every statement uses it.
Everything runs locally in your browser.
Whether the CSV is a customer export or a list of test fixtures, nothing is uploaded — the conversion is just JavaScript on your machine.
FAQ
How are quotes and apostrophes escaped?
Text values are wrapped in single quotes and any embedded single quote is doubled (O'Brien becomes 'O''Brien'), which is the SQL standard escape accepted by every major database.
How does it decide what is a number?
Cells that look like an integer or decimal (optionally signed, with an exponent) are emitted unquoted. Empty cells become NULL, and everything else is treated as a quoted string.
Which SQL dialect does it target?
The output uses standard INSERT syntax and standard quote escaping, so it works across PostgreSQL, MySQL, SQLite, SQL Server and most others.