About the CSV to SQL Converter tool
Loading a spreadsheet into a database usually means writing INSERT statements, and doing that by hand for more than a few rows is tedious and full of quoting mistakes. This CSV to SQL converter turns a CSV export into ready-to-run SQL: an optional CREATE TABLE statement followed by batched INSERT statements.
The CSV is parsed with a proper RFC 4180 reader, so quoted fields, commas inside quotes, escaped double quotes and line breaks inside cells are handled, and the delimiter is detected automatically or chosen by you. Column types are inferred from the data: whole numbers become INT or BIGINT, decimals become DOUBLE, REAL or FLOAT depending on the database, true/false columns become BOOLEAN or BIT, YYYY-MM-DD values become DATE, date-times become DATETIME or TIMESTAMP, and everything else becomes VARCHAR sized to the longest value. Codes with leading zeros, such as postal codes, stay text.
Pick MySQL, PostgreSQL, SQLite or SQL Server and the identifiers, string literals and booleans follow that dialect: backticks, double quotes or square brackets, doubled single quotes, N'…' strings for SQL Server and backslash escaping for MySQL. Choose how many rows go into each INSERT, from one per row up to 1,000, the maximum SQL Server accepts.
How to use CSV to SQL Converter
- Paste CSV into “CSV input”, open a .csv or .tsv file, or click “Load sample”.
- Enter the “Table name” and choose the “SQL dialect”.
- Set “Rows per INSERT”, the “Delimiter” and whether the “First row is header”.
- Toggle “CREATE TABLE” and “Empty cells as NULL” as needed.
- Review the column summary comment at the top, then copy or download the .sql file.
Features
Four SQL dialects
Correct identifier quoting, literals and types for MySQL, PostgreSQL, SQLite and SQL Server.
Type inference
INT, BIGINT, decimal, boolean, DATE, DATETIME and sized VARCHAR columns are detected from the data.
Robust CSV parsing
Quoted fields, embedded commas, escaped quotes and multi-line cells are read correctly.
Batched inserts
Group 1 to 1,000 rows per INSERT for faster imports.
Safe escaping
Apostrophes like O'Connor are escaped so the SQL runs without syntax errors.
When to use it
- Seed a development database with sample data from a spreadsheet.
- Import a customer list exported from a CRM into MySQL or PostgreSQL.
- Create a SQLite table from a CSV for quick local analysis.
- Generate SQL Server INSERT scripts for a migration ticket.
Frequently asked questions
How are column types chosen?
Every non-empty value in a column is checked. If all are integers the column is INT (or BIGINT for large values), if all are numbers it is a floating type, and so on down to VARCHAR/TEXT. Review the CREATE TABLE and adjust types such as DECIMAL(10,2) for money if you need exact precision.
How are empty cells handled?
With “Empty cells as NULL” on, blank cells become NULL. With it off, blank text cells become empty strings, while blank numeric or date cells still become NULL because an empty string is not a valid number or date.
Why is there a 1,000-row limit for SQL Server?
SQL Server rejects INSERT … VALUES lists with more than 1,000 rows, so batches are capped at 1,000 for that dialect.
Is it safe to paste customer data?
Yes. The CSV is parsed and the SQL is generated entirely in your browser; nothing is uploaded.
Can it handle semicolon-separated files from Excel?
Yes. The delimiter is detected automatically, and you can force comma, semicolon, tab or pipe.