Guide
Generating CREATE TABLE and INSERT statements from a CSV
Moving a spreadsheet into a database usually means writing a CREATE TABLE statement, guessing column types and then thousands of INSERT lines with careful quoting. This tool does all of it from a CSV or Excel file, for MySQL, PostgreSQL, SQLite or SQL Server, and shows you the inferred types before you run anything.
Choosing the database
Each database quotes names and escapes text differently. MySQL uses backticks and treats backslashes as escape characters, so they are doubled. PostgreSQL and SQLite use double quotes around names. SQL Server uses square brackets and writes text as N’…’ so Unicode characters survive. Pick the database and the script follows its rules.
How types are inferred
Each column gets the narrowest type that fits every non-empty value. Whole numbers become INT, or BIGINT beyond about two billion. Decimals become DECIMAL or NUMERIC with exactly the precision and scale the data needs, such as NUMERIC(7,2) for prices. ISO dates become DATE, date-times DATETIME, TIMESTAMP or DATETIME2, and true/false values BOOLEAN or the database’s equivalent. Everything else is VARCHAR sized with some headroom, or TEXT for long values. The column table shows every decision before you copy the script.
Leading zeros and IDs
Values with leading zeros, like 007 or 02134, keep the column as text, because a numeric type would silently drop the zero. Numbers written with thousands separators, such as 1,200.50, also stay text; clean them first if you want a numeric column.
NULL and empty cells
With “Empty cells as NULL”, empty cells become NULL, which databases treat as missing. Switch it off to insert empty strings into text columns instead. Numeric and date columns always use NULL for empty cells, since an empty string is not a valid number or date.
Names
“snake_case column names” turns headers like “Order ID” or “Prénom Client” into order_id and prenom_client, which are easy to type in queries. Switch it off to keep the original names, which are then quoted. Duplicate names get a numeric suffix. Table names may include a schema, written as schema.table.
Batching and transactions
Rows are grouped into multi-row INSERT statements, 100 per statement by default, which loads much faster than one statement per row. SQL Server accepts at most 1,000 rows per statement. Wrapping the script in a transaction means either all rows are inserted or none, if something fails halfway. DROP TABLE IF EXISTS replaces an earlier test table.
Review before running
Generated SQL is code. Check the table name, the types and a few INSERT lines, and run it in a development or test database first, especially when real data matters.
SQLite and its flexible types
SQLite stores dates as text and decimals as REAL, and accepts any value in any column. The script therefore uses TEXT for dates and REAL for decimals there. If you need exact money values in SQLite, store amounts as integers in cents in your application.
Related tools
Tidy queries with the SQL Formatter. Create realistic test data with the Mock Data Generator, which can write SQL directly. To check what a CSV contains before loading it, use the CSV Data Profiler.
Checked against the current version of the CSV to SQL on .

