About the CSV to SQL Converter
Load a spreadsheet export into a database without an import wizard: paste the CSV and copy ready-to-run SQL.
Spreadsheets and exports from other systems usually arrive as CSV, while databases want SQL. Import wizards differ between MySQL Workbench, pgAdmin, SQLite browsers and SQL Server Management Studio, and many shared hosts do not offer them at all. This converter writes plain SQL that any client can run.
The first row of the CSV becomes the column names, which are cleaned into safe identifiers (spaces become underscores, odd characters are removed). The tool looks at every value in a column to choose a type: whole numbers become INT or BIGINT, decimal numbers become DECIMAL or NUMERIC, true and false become BOOLEAN, ISO dates become DATE and everything else becomes text sized to the longest value. You can switch the CREATE TABLE statement off if the table already exists.
Values are quoted and escaped for the dialect you choose, identifiers use backticks for MySQL, double quotes for PostgreSQL and SQLite, and square brackets for SQL Server, and rows are grouped into multi-row INSERT statements for faster loading.
A summary line above the output lists the number of rows and every column with its detected type, so you can spot a wrong delimiter or a shifted column before running anything. You can also download the script as a .sql file, which is handy for large imports or for keeping in version control alongside an application.
How to use the CSV to SQL Converter
- 1Paste CSV or open a .csv file.
- 2Set the table name, dialect and options.
- 3Copy or download the SQL and run it in your database.
Key features
- MySQL, PostgreSQL, SQLite and SQL Server dialects.
- Automatic column type detection.
- Optional CREATE TABLE statement.
- Batched multi-row INSERTs.
- Auto-detects comma, semicolon, tab and pipe delimiters.
Practical uses
- Loading a product list from Excel into a website database.
- Creating seed data for development and tests.
- Moving a small table between different database engines.
Tips and common mistakes
- Check the detected types in the CREATE TABLE before running it.
- Run the script inside a transaction so you can roll back if something is wrong.
- Remove totals rows and notes from the spreadsheet before exporting.
Limitations
- Primary keys, indexes and foreign keys are not created.
- Dates in formats other than YYYY-MM-DD are treated as text.
Privacy
Your data is converted in the browser and is never uploaded.
Frequently asked questions
How are column types chosen?
From the values: whole numbers become INT, decimals DECIMAL/NUMERIC, true/false BOOLEAN, YYYY-MM-DD dates DATE, everything else text sized to fit.
How are quotes handled?
Single quotes inside text are doubled (O’Neil → O’’Neil), which is the SQL standard way to escape them.
What happens to empty cells?
They become NULL.
Is there a row limit?
No fixed limit, but very large files are slow in a browser tab; split files with hundreds of thousands of rows.