CSV to SQL INSERT Generator
Convert CSV to SQL INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server, with CREATE TABLE (types guessed), batching, NULLs, transactions and safe escaping.
Tool
About this tool
About CSV to SQL INSERT Generator
Import spreadsheet data into a database without a GUI. Paste or upload a CSV, choose your database and table name, and get INSERT statements with properly quoted names and escaped values (O’Neil stays safe). The generator can add a CREATE TABLE with column types guessed from the data (INT, DECIMAL, DATE, DATETIME, BOOLEAN, VARCHAR), group rows into multi-row INSERTs, turn empty cells into NULL, wrap everything in a transaction and skip rows that already exist.
How it works
Example
How to use this tool
- Paste or choose the CSV.
- Choose the database, table name and options.
- Copy or download the .sql file and run it.
Frequently asked questions
How many rows per INSERT?
100–1000 is fast and safe for most servers. SQL Server allows at most 1000 rows per VALUES list.
Are the guessed types always right?
They are a good start. Check lengths and change VARCHAR sizes or add keys before running on production.
Is my data uploaded?
No. Everything is processed in your browser and stays on your device.
Are my files uploaded by the CSV to SQL INSERT Generator?
No. The CSV to SQL INSERT Generator reads your files in your browser, so your data stays on your device. Very large files may be slow on older phones.