CSV to SQL
A CREATE TABLE plus batched INSERTs for Postgres, MySQL or SQLite.
- 100% local conversion
- No file uploads
- Preserves structure
- Supports large files
INSERT INTO people (name, role)
VALUES ('Ada', 'Engineer');
More formats coming soon
Data Preview
Conversion Complete!
Your file has been converted successfully.
Share this tool
Converting…
0 rows
- check_circleReading file
- check_circleParsing data
- progress_activityConverting format
- radio_button_uncheckedGenerating output
- radio_button_uncheckedFinalizing file
Your data never leaves your device. Everything is processed locally in your browser.
Also: SQL to CSV
Paste SQL INSERT statements and extract the data as a CSV — column names come from the first INSERT.
CSV to SQL: Generating INSERT Statements for Any Database
Migrating data from a spreadsheet into a relational database is one of the most common developer tasks. Converting a CSV to SQL INSERT statements lets you load data into MySQL, PostgreSQL, SQLite, SQL Server, or any ANSI SQL-compatible database without writing a custom import script or using a GUI tool.
ConvertRow generates one INSERT INTO statement per CSV row, using the column headers as the field names in the statement. The output is a standard SQL script you can run directly in a database client, paste into a migration file, or include in a seed script for a web framework. All string values are single-quoted and escaped, and numeric values are left unquoted.
The conversion runs locally in your browser — no server, no upload, no account. For sensitive data like customer records or financial tables, this means nothing leaves your machine during the conversion process.
For best results, use column headers that are valid SQL identifiers: lowercase letters, numbers, and underscores, starting with a letter. Avoid reserved SQL keywords like order, group, or table as column names, or they may need to be backtick-quoted in MySQL. Review the generated SQL before running it on a production database — always test on a staging environment first.
Common use cases for CSV to SQL conversion:
- Loading an initial dataset into a new database table during development
- Creating seed data for automated tests or demo environments
- Migrating data exported from one database system to another
- Generating a data import script from a client-supplied spreadsheet
- Populating a lookup table from a business-maintained CSV file
Frequently Asked Questions
The output follows ANSI SQL syntax and is compatible with MySQL, MariaDB, PostgreSQL, SQLite, and SQL Server. Minor differences exist — for example, MySQL uses backticks for identifiers while PostgreSQL uses double quotes — but the INSERT statement format is universally accepted.
By default the table name is "data" (INSERT INTO data ...). You can specify a custom table name in the converter options before clicking Convert. Change it to match the actual table you want to insert into.
All string values are single-quoted and single quote characters within values are escaped by doubling them ('' style), which is ANSI SQL standard escaping. This prevents syntax errors from values containing apostrophes. This output is intended for trusted data migration, not for use in dynamic queries in application code.
Yes, the converter includes an option to prepend a CREATE TABLE statement. The column types are inferred from the CSV values — numeric columns get INTEGER or REAL types, and all others get TEXT. Review the inferred types before running on a real database.
There is no hard limit. For very large CSVs, the generated SQL file can become large — a 100,000-row CSV with 10 columns typically produces a SQL file of several megabytes. Bulk-load tools like MySQL's LOAD DATA INFILE or PostgreSQL's COPY command are more efficient for very large imports.