CSV to SQL INSERT Converter
Paste CSV or spreadsheet cells, name the table and get INSERT statements for MySQL, SQL Server or standard SQL. Text is quoted, numbers are not and empty cells become NULL.
Este contenido está en inglés.
Ejemplos resueltos
Two rows
name,qty Tea,2 Coffee,5
INSERT INTO `orders` (`name`, `qty`) VALUES ('Tea', 2), ('Coffee', 5);
Text is quoted, numbers are not, and names use backticks.
Empty cell and apostrophe
name,note Ann, Bo,it's fine
INSERT INTO "notes" ("name", "note") VALUES ('Ann', NULL); INSERT INTO "notes" ("name", "note") VALUES ('Bo', 'it''s fine');
The empty cell becomes NULL and the apostrophe is doubled.
Sobre CSV to SQL INSERT Converter
This converter turns CSV into SQL INSERT statements. Paste CSV or cells copied from a spreadsheet, give the table a name and get statements you can run against MySQL, SQL Server or any database that uses standard SQL.
Text is quoted with apostrophes doubled, numbers are written without quotes, empty cells become NULL, and column names are quoted the way your database expects. You can write one INSERT for all rows or one per row, and add a CREATE TABLE statement with guessed column types.
Cómo usar CSV to SQL INSERT Converter
- Paste your CSV, or open a CSV file.
- Set the table name, the quoting style and whether the first row holds the column names.
- Copy the SQL, or download it as a .sql file.
Usos habituales
- Loading a spreadsheet into a database table
- Creating seed data for development
- Moving a small export between systems
- Turning a list into test records
Preguntas frecuentes
How are text and numbers written?
Text is put in single quotes and any apostrophe inside is doubled. Whole numbers and decimals are written without quotes. Empty cells become NULL.
Which databases does it suit?
Choose backticks for MySQL, square brackets for SQL Server or double quotes for standard SQL, which suits PostgreSQL and SQLite. The statements use plain INSERT syntax that all of them accept.
How accurate is the CREATE TABLE?
It guesses INTEGER, DECIMAL or VARCHAR from the values. That is a starting point, and you should check the types and sizes for your own data.
Are numbers with leading zeros kept?
Yes. A value such as 007 is written as text so the zeros are not lost.