Your CSV
Comma, semicolon, tab or pipe separated; the delimiter is detected. Quoted fields with commas and line breaks are handled.
Paste a CSV and click Generate.
Generated SQL
| Column | From header | Type | Nullable |
|---|
Run it on files from the command line
node cli.mjs data.csv # PostgreSQL
node cli.mjs data.csv --dialect mysql --table orders --drop
cat export.csv | node cli.mjs --dialect sqlite | sqlite3 app.db
node cli.mjs data.csv --dialect bigquery --dmy --no-header
Get cli.mjs and sql.mjs from the repo. Node 18+, no dependencies.
Common questions
How do I convert a CSV file to SQL INSERT statements?
Paste the CSV, pick your database and click Generate. The tool writes a CREATE TABLE with a type for every column, then INSERT statements for every row, batched so a big file stays loadable. Copy the result into psql, mysql, sqlite3, SQL Server Management Studio or the BigQuery console.
How does it choose column types?
It reads every row, not just the first. A column becomes INTEGER or BIGINT when every value is a whole number, NUMERIC(p,s) sized to the longest value when decimals appear, BOOLEAN for true/false/yes/no, DATE or TIMESTAMP when every value parses as one, UUID for UUIDs, and text otherwise. A single odd value turns a column into text rather than failing the import.
Why is my ZIP code or phone number kept as text?
Numbers with leading zeros, such as the ZIP code 02134, lose the zero if stored as an integer. The tool keeps those columns as text and tells you it did.
Which databases are supported?
PostgreSQL, MySQL, SQLite, SQL Server and BigQuery. Each gets its own type names, quoting, boolean literals and batch limits, so the script runs as written.
Does this upload my CSV?
No. Everything runs in this page and the page makes no network calls, so a file full of customer data stays on your device. The command-line version reads a file or stdin on your machine and prints to your terminal.
What about very large files?
The page handles up to 200,000 rows. Beyond that use your database's bulk loader (PostgreSQL COPY, MySQL LOAD DATA, sqlite3 .import, bq load), which is faster than INSERT statements anyway. The guide shows how, and the command-line tool can still generate the CREATE TABLE.
More: how to import a CSV into PostgreSQL, MySQL, SQLite and BigQuery (INSERT vs COPY vs LOAD DATA)