CSV to SQL Converter

Turn a CSV into SQL INSERT statements for MySQL, PostgreSQL, SQLite, or SQL Server, right in your browser. Your data stays on your device.

The CSV to SQL Converter runs entirely in your browser. The CSV you paste or drop and the SQL it generates never leave your device and nothing is uploaded to ArrayKit.

Open the SQL Formatter

About CSV to SQL

The CSV to SQL Converter turns a CSV file into ready-to-run SQL. Paste or drop your data, pick a dialect — MySQL, PostgreSQL, SQLite, or SQL Server — and it infers each column's type, quotes the table and column names the way that dialect expects, and escapes every value so single quotes, empty cells, numbers, and booleans come out correct. You get one INSERT per row or a batched multi-row INSERT, plus an optional CREATE TABLE so you can seed a schema from scratch. It is built for developers seeding a dev database, importing a spreadsheet export, or writing a migration who want the SQL generated for them instead of hand-typing thousands of values. The whole conversion happens in your browser, so the CSV you load never leaves your device.

Features

How to use the CSV to SQL

  1. Paste your CSV or choose a .csv file — keep the first row as the header
  2. Pick the target dialect: MySQL, PostgreSQL, SQLite, or SQL Server
  3. Set the table name and toggle CREATE TABLE on if you need the schema
  4. Copy the generated SQL or download it as a .sql file

Example

Input

id,name,active
1,O'Brien,true
2,Ada,false

Output

INSERT INTO `my_table` (`id`, `name`, `active`) VALUES (1, 'O''Brien', 1);
INSERT INTO `my_table` (`id`, `name`, `active`) VALUES (2, 'Ada', 0);

The apostrophe in O'Brien is escaped and the booleans become 1 and 0 for MySQL.

Common errors & troubleshooting

Frequently asked questions

How does the CSV to SQL Converter decide each column's type?
It scans every non-empty cell in a column. If they are all whole numbers it uses integer, all numeric with a decimal it uses float, all true/false-style tokens it uses boolean, and otherwise text. Zero-padded numbers like 007 stay text so leading zeros are not lost.
How are single quotes and apostrophes in my data handled?
String values are wrapped in single quotes and any embedded single quote is doubled ('' ), which is the standard SQL escaping. So O'Brien becomes 'O''Brien' and runs safely across all four dialects.
What SQL does it generate for empty cells?
Empty cells and the tokens NULL, NA, and N/A become the SQL keyword NULL rather than an empty string, so your rows insert with genuine nulls instead of blank text.
Can it create the table as well as insert the rows?
Yes. Turn on CREATE TABLE and it emits a CREATE TABLE statement with a column type mapped for your dialect, then the INSERTs. MySQL, PostgreSQL, and SQLite use IF NOT EXISTS so the script is re-runnable.
What is the multi-row INSERT option for?
By default each row is its own INSERT statement, which is easy to read and diff. Multi-row INSERT groups many rows into one statement with a shared VALUES list, which loads large files faster in MySQL, PostgreSQL, and SQLite.
Does my CSV get uploaded to generate the SQL?
No. Parsing and SQL generation run entirely in your browser using JavaScript. The CSV you paste or drop is never sent to a server, so sensitive spreadsheet exports stay on your device.

Related tools

All ArrayKit tools