Loading...
Loading...
Generate SQL INSERT statements from CSV data. Set the table name, paste your CSV, and get a ready-to-run SQL script for PostgreSQL, MySQL, or SQLite.
Each CSV row produces one INSERT INTO statement. The column names come from the CSV header row. String values are single-quoted and any single quotes within the value are escaped by doubling them, which is the standard SQL escape mechanism supported by PostgreSQL, MySQL, MariaDB, and SQLite. Numeric-looking values are output unquoted as SQL number literals. Empty cells are output as empty strings by default, though a NULL option is available if your schema expects NULL for missing values.
The table name you enter in the form field appears in every INSERT INTO table_name statement. The column list is derived directly from the first row of the CSV and appears in parentheses after the table name. This means the column order in the output matches the column order in the source file.
Seeding a local development database from a production data export is one of the primary uses. You export a subset of records from production as CSV, convert to SQL here, and run the script against your dev database. This is faster than writing a migration script and more reliable than copying a database snapshot.
Importing reference data into a new schema is another fit. Country codes, currency lists, product categories, and other lookup tables are often distributed as CSV. Converting to SQL INSERT statements means you can include the seed data directly in your database migration files, so a fresh database setup runs the migrations and gets the reference data in one step.
Migrating a flat file into a relational table without writing a migration script saves time when the data is already clean and the schema is straightforward. Convert the CSV here, paste the output into your SQL client, and the data is in the table.
Paste the output into psql, MySQL Workbench, SQLiteOnline, DBeaver, TablePlus, or any SQL client that accepts raw INSERT statements. Test on a small sample first to confirm column type compatibility before running on a full dataset. Wrap the statements in a transaction (BEGIN; ... COMMIT;) so you can roll back the entire batch if any row fails type validation.
Does it generate CREATE TABLE statements?
No. The output is INSERT statements only. You need to create the table with the correct schema before running the script. The column names from the CSV headers must match the column names in your table definition.
What happens with special characters in values?
Single quotes in string values are escaped by doubling them. Backslashes are not treated specially unless your database uses non-standard escape sequences. Values are not further sanitised, so use this tool only on data you trust.
Which databases does the output work with?
The output uses standard SQL INSERT syntax and is compatible with PostgreSQL, MySQL, MariaDB, SQLite, and most other relational databases. It does not use any vendor-specific extensions or syntax.