CSV to SQL INSERT
Generate SQL INSERT statements from CSV.
CSV into INSERT statements
Paste a CSV and this builds INSERT statements using the header as column names and each row as a set of values, escaping quotes so the SQL is valid. It saves hand-writing bulk inserts.
It saves hand-writing a bulk insert for a quick migration or seed script, though you should confirm the column types and add any needed escaping for your specific database.
Review before running
Check types and your table schema before executing against a real database. The generation runs locally in your browser with nothing uploaded. Your data is transformed on your device with nothing uploaded.
Frequently asked questions
What does this csv to sql insert do?
Turn CSV rows into SQL INSERT statements for quick seed data or imports.
How are values escaped?
Single quotes inside values are doubled, so O'Brien becomes 'O''Brien', and empty cells become NULL. Every other value is inserted as a quoted string.
Why are the column names in double quotes?
Double quotes are standard SQL for identifiers and work in PostgreSQL and SQLite. MySQL needs ANSI_QUOTES mode, or swap them for backticks.
Does it create the table?
No. It outputs one INSERT per row for a table that already exists. The table name is stripped to letters, numbers, and underscores for safety.
Related tools
More free browser utilities for data cleanup, formatting, and developer workflows.