Convert CSV data to SQL INSERT, CREATE TABLE, or UPSERT statements instantly. Browser-based, free, no sign-up required.
HOW TO USE
-
01
Paste your CSV data
Paste any CSV β spreadsheet exports, API output, database dumps, or hand-crafted data. Select the correct delimiter if your file uses semicolons, tabs, or pipes instead of commas.
-
02
Choose your options
Set the table name, select your SQL dialect (MySQL, PostgreSQL, or SQLite), and pick the statement type β INSERT, CREATE TABLE, both together, or UPSERT. Toggle the header row option if your first row is column names.
-
03
Convert and export
Click Convert to SQL and the output appears instantly. Copy it to clipboard or download as a
.sqlfile ready to run withmysql,psql, orsqlite3.
FEATURES
- MySQL, PostgreSQL, SQLite dialects
- INSERT, CREATE TABLE, UPSERT modes
- Auto NULL & numeric detection
- Custom delimiter support
- Live CSV preview table
- Copy to clipboard
- Download as .sql file
- Row & column stats
USE CASES
- β‘ Seed a development or staging database from a CSV export
- β‘ Migrate spreadsheet data into MySQL, PostgreSQL, or SQLite
- β‘ Generate bulk INSERT statements for database fixtures
- β‘ Create a table schema from a CSV header row
- β‘ Prepare data imports for ETL pipelines
- β‘ Convert exported reports to SQL for further analysis
WHAT IS THIS?
CSV to SQL converts comma-separated value files into ready-to-run SQL statements. Paste your CSV, choose a dialect and statement type, and get INSERT or CREATE TABLE statements with proper quoting, NULL handling, and numeric type detection β all in your browser, free, with no data sent to any server.
FREQUENTLY ASKED QUESTIONS
What SQL statements can I generate?
You can generate INSERT INTO, CREATE TABLE IF NOT EXISTS, or both together in a single output. There is also an UPSERT mode β MySQL uses ON DUPLICATE KEY UPDATE, PostgreSQL uses ON CONFLICT DO NOTHING, and SQLite uses INSERT OR REPLACE. Choose the mode that matches your import workflow.
Which SQL dialects are supported?
MySQL uses backtick-quoted identifiers (`column`). PostgreSQL uses double-quoted identifiers ("column"). SQLite uses backtick quoting and INSERT OR REPLACE for upserts. All three are generated correctly β switch the dialect dropdown before converting and the output updates to match.
Does it handle CSV files with quoted fields and commas inside values?
Yes. The parser follows RFC 4180 β fields wrapped in double quotes are parsed correctly, including values that contain commas, newlines, or embedded double quotes escaped as "". Select the correct delimiter for your file before converting.
How are data types handled?
The converter detects numeric values (integers and decimals) and outputs them unquoted so they are stored as numbers in the database. Empty cells and the literal string NULL (case-insensitive) are converted to SQL NULL. All other values are output as single-quoted strings with internal quotes escaped. For precise type control, generate the CREATE TABLE statement and edit column types manually before running the import.
Which delimiters are supported?
Comma (,), semicolon (;), tab (\t), and pipe (|). European CSV exports from Excel commonly use semicolons because commas are used as decimal separators in many locales. TSV (tab-separated) files from database tools are also supported β select tab from the delimiter dropdown.
What happens if the CSV has no header row?
Uncheck the First row as headers option. The tool will automatically generate column names as col_0, col_1, col_2, and so on. You can rename them in the generated CREATE TABLE statement after conversion.
Is my data sent to a server?
No. All CSV parsing and SQL generation runs entirely in your browser using JavaScript. No data leaves your machine. The tool works offline once the page has loaded and is safe to use with sensitive or confidential data.
CSV to SQL Converter β Import CSV Data into Any Database
CSV is the universal format for tabular data export β every spreadsheet application, SaaS platform, and database tool can produce a CSV file. But getting that data into a relational database requires SQL, specifically INSERT INTO statements with properly quoted values, escaped strings, and correct NULL handling. Writing those statements by hand for hundreds or thousands of rows is error-prone and slow. This tool generates them instantly from any CSV input.
MySQL, PostgreSQL, and SQLite Support
Each SQL dialect has different conventions for identifier quoting and upsert syntax. MySQL wraps column and table names in backticks β `table_name` β to avoid conflicts with reserved words. PostgreSQL uses double-quoted identifiers β "table_name". SQLite accepts both but conventionally uses backticks. The UPSERT statement differs across all three: MySQL uses ON DUPLICATE KEY UPDATE, PostgreSQL uses ON CONFLICT DO NOTHING, and SQLite uses INSERT OR REPLACE INTO. Selecting the right dialect from the dropdown generates output that runs without modification in your target database.
CREATE TABLE and INSERT Together
When migrating data into a new table, you need both the schema definition and the data rows. The CREATE + INSERT mode generates a CREATE TABLE IF NOT EXISTS statement with all columns typed as TEXT, followed by the full set of INSERT statements. Copy the output, run it against your database, and the table is created and populated in a single operation. Edit the column types in the CREATE TABLE block to match your intended schema β change TEXT to INT, DECIMAL, DATE, or whatever your data requires.
Spreadsheet Migration and Data Seeding
Two of the most common CSV-to-SQL workflows are spreadsheet migration and database seeding. Migrating a Google Sheets or Excel workbook into a MySQL or PostgreSQL database means exporting each sheet as CSV, converting it to INSERT statements, and running the import β a process that can be completed in minutes with this tool. Database seeding for development environments follows the same pattern: export test data as CSV, generate INSERT statements, and include them in migration scripts or fixture files for repeatable environment setup.
NULL and Numeric Detection
Correct NULL and type handling is critical for data integrity. This converter detects empty CSV cells and the literal string NULL (case-insensitive) and outputs SQL NULL rather than an empty string or the word "NULL" as a string literal. Integer and decimal values are output unquoted so they are stored as numbers rather than strings. This means numeric columns will sort, aggregate, and index correctly without requiring a post-import type conversion step.