CSV to SQL Converter
Turn a spreadsheet export into a script your database can run. The header row names the columns, every line becomes an INSERT, and quoting follows the dialect you pick.
Data Converter
or drop CSV, TSV, TXT … files here ·
Max 95 MB per file· Up to 20 files· Deleted after 30 minutes
Files are processed on our servers and deleted after 30 minutes.
Character that separates columns in CSV and text files, for both reading and writing. Auto detects it from the input and writes commas.
UTF-8 works for every language. Choose UTF-8 with BOM if Excel on Windows shows garbled accents or Asian characters when opening the CSV.
Excel, ODS and Numbers input: convert the first sheet only, or every sheet (one CSV per sheet in a ZIP, or one JSON key per sheet).
Name of the sheet tab in the new spreadsheet, up to 31 characters.
Array of objects uses column names as keys for every row; array of arrays is more compact and keeps the header as the first array.
Name of the outer element that wraps all rows; each row becomes a <row> inside it.
Used in CREATE TABLE and INSERT statements. Letters, digits and underscores only.
Quoting and column types differ slightly between databases; pick the one you will import into.
Rewrite date cells in one format. ISO (2026-10-18) is safest for databases and code; keep leaves them as they appear in the source.
How to use this tool
- 1
Upload the CSV
Add one CSV or up to 20, 95 MB each. Semicolon and tab files are detected automatically.
- 2
Set table and dialect
Under Advanced settings, type the SQL table name and choose the SQL dialect: MySQL, PostgreSQL, SQLite or SQL Server. Dates is set to ISO so date literals load without guessing.
- 3
Convert and run
Press Convert to SQL, read the CREATE TABLE line, then run the script in your database client or import screen.
CSV to SQL writes a CREATE TABLE statement from your header row and one INSERT per data row, quoted for MySQL, PostgreSQL, SQLite or SQL Server, so a spreadsheet loads into a database by running a single script.
Why turn a CSV into SQL INSERT statements
Every database has a fast CSV loader, and every one of them has a catch. LOAD DATA LOCAL INFILE is disabled by default on the server since MySQL 8.0, COPY FROM a file needs superuser rights or membership in a special role in PostgreSQL, and SQL Server's BULK INSERT reads paths on the server machine, not your laptop. Hosted databases often expose nothing but a query editor.
An INSERT script sidesteps all of that. It is text, so you can read it, commit it to version control as seed data, and run it in any client. The trade-off is speed: tens of thousands of rows load fine, while millions belong in a native bulk loader. Developers who keep reference data in a workbook can skip the CSV step with Excel to SQL.
CSV to SQL example for MySQL
CREATE TABLE `my_table` ( `id` INT, `name` VARCHAR(255), `joined` DATE ); INSERT INTO `my_table` (`id`, `name`, `joined`) VALUES (1, 'Ana Ruiz', '2026-03-02'), (2, 'Liam O''Brien', '2026-04-15');
How the four SQL dialects differ in the output
Identifiers are wrapped in backticks, as in order date, which also lets reserved words such as order serve as column names.
- Fits MariaDB as well
- Good default for phpMyAdmin imports
Identifiers use standard double quotes. Quoted names keep their case, so "Email" and email are two different columns.
- Names longer than 63 bytes are cut short
Double quotes again, with flexible typing: a column declared INT still accepts text unless the table is declared STRICT, an option added in SQLite 3.37.0.
- Runs in the sqlite3 shell or DB Browser for SQLite
Identifiers go in square brackets, as in [order date]. Text columns that hold non-Latin characters need NVARCHAR and N'…' literals.
- Runs in SSMS or Azure Data Studio
| Organisation | Requirement | Source |
|---|---|---|
| MySQL 8.0 | max_allowed_packet defaults to 64 MB; a single statement larger than that is refused | — |
| SQL Server | One INSERT … VALUES list accepts at most 1,000 row value expressions | — |
| PostgreSQL | Identifiers longer than 63 bytes are silently truncated | — |
| SQLite | A table has at most 2,000 columns in a default build | — |
Check these before you run the script
Read the CREATE TABLE line first. Column types are guessed from the values, and a guess can be wrong: ZIP codes and phone numbers look numeric but must stay text, or 02134 loses its leading zero. Change the type in the script before running it, or create the table yourself and run only the INSERT part.
Type the real name into SQL table name instead of my_table, and run the script inside a transaction where your client allows it, so one bad row rolls everything back. Other targets for the same CSV are on the data converter hub.
CSV and SQL script formats
CSV
Comma-separated values
CSV is a plain-text format for tables in which each line is a row and commas separate the columns. It has been used since the early days of computing and is described in RFC 4180, though many variants use semicolons or tabs and different text encodings. Nearly every spreadsheet, database and analytics tool can import and export it, which makes it the default format for moving data between systems. CSV stores only values, with no formulas, formatting, multiple sheets or data types.
- Compression
- –
- Transparency
- –
- Animation
- –
- Introduced
- –
SQL
SQL script
An SQL file is a plain-text script of Structured Query Language statements, such as CREATE TABLE and INSERT, that a database runs in order. It is commonly used for database backups, migrations and sharing sample data. The language itself is an ISO standard, but MySQL, PostgreSQL, SQLite and SQL Server each have their own dialects, so scripts often need small changes between systems. Any text editor can open an SQL file, and a database client is needed to execute it.
- Compression
- –
- Transparency
- –
- Animation
- –
- Introduced
- –
CSV becomes SQL when a file has to end up as a table in a database you can only reach through a query window: seeding a new app, loading a reference list or moving a spreadsheet into MySQL or PostgreSQL without server access.
CSV to SQL converter questions
Why use a SQL file instead of LOAD DATA or COPY?
Bulk loaders such as MySQL's LOAD DATA INFILE and PostgreSQL's COPY are faster but need file access on the server or extra client flags. A plain script runs anywhere you can paste SQL: a cloud database console, phpMyAdmin or a reviewed migration.
How are apostrophes in names like O'Brien written?
Inside a SQL string a single quote is escaped by doubling it, so the value is written as 'O''Brien'. All four dialects accept that form, which is why a name with an apostrophe does not break the INSERT.
What do my CSV headers become in the table?
Column names, quoted the way the chosen dialect expects. Headers like Unit Price work, but a quoted name with a space has to be quoted in every later query too, so rename such headers to unit_price before converting if you can.
Can I import the SQL file through phpMyAdmin?
Yes, on the Import tab. The ceiling there is PHP's upload_max_filesize, which is 2 MB in a stock php.ini; many hosts raise it, and the page shows the current limit. Split a large CSV into several files if the script is bigger than that.
Is there a way back from a table to CSV?
Export the table as a dump and convert it with SQL to CSV, or use your database client's own CSV export. Both give you rows a spreadsheet can open again.
- Excel to SQL ConverterTurn an Excel sheet into a SQL script for MySQL, PostgreSQL, SQLite or SQL Server. Headers become columns, rows become INSERT statements.
- SQL to CSV ConverterConvert the INSERT statements in a .sql dump to CSV rows you can open in Excel or Google Sheets. MySQL, phpMyAdmin, SQLite and SQL Server dumps.
- CSV to XLSX ConverterConvert CSV to an Excel XLSX workbook with leading zeros, long IDs and accented text intact. Comma, semicolon and tab files detected automatically.
- CSV to XML ConverterConvert CSV rows to well-formed XML with your own root tag. Special characters escaped, delimiter detected, UTF-8 output. Up to 20 files at once.
- CSV to Parquet ConverterConvert CSV to Apache Parquet with typed columns and compression, ready for pandas, DuckDB, Spark, BigQuery or Athena. No Python or Spark setup needed.
- Parquet to CSV ConverterConvert Apache Parquet files to CSV online and open them in Excel, Google Sheets or any importer. No Python, Spark or DuckDB needed. Up to 20 files.