CSV to SQL Converter

Turn spreadsheet rows into ready-to-run INSERT statements, with an optional CREATE TABLE.

100% Client-Side Processing — your data never leaves this browser. Works offline. How it works

0 lines • 0 bytes Ready
Tip: drop a file anywhere on the editor
Input
Paste, type or drop a file
1
Result
Updates as you type
// Output will appear here…
About this tool

How the CSV to SQL works

Convert CSV to SQL INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server, with optional CREATE TABLE and detected column types. Runs in your browser.

How to use the CSV to SQL

  1. Paste CSV or upload a .csv file. The delimiter is detected automatically.
  2. Enter the table name and choose MySQL, PostgreSQL, SQLite or SQL Server.
  3. Optionally add CREATE TABLE, then copy or download the .sql file.

CSV to SQL example

Input
id,name,price
1,Keyboard,129.99
2,"Monitor 27""",349
Result
INSERT INTO `products` (`id`, `name`, `price`) VALUES
  (1, 'Keyboard', 129.99),
  (2, 'Monitor 27"', 349);

When to use it

  • Seeding a development or test database from a spreadsheet.
  • Importing a CSV export into a database that has no import wizard.
  • Writing migration or fixture files for a pull request.

Tip: For very large files, keep 1000 rows per INSERT: multi-row statements import much faster than one statement per row.

Four SQL dialects

Correct identifier quoting and booleans for MySQL/MariaDB (`backticks`), PostgreSQL, SQLite ("double quotes") and SQL Server ([brackets]).

Detected column types

Numbers, booleans, dates and text are recognised per column, so CREATE TABLE gets INT, DOUBLE, BOOLEAN, DATE or VARCHAR instead of TEXT everywhere.

Batched INSERTs

Write one multi-row INSERT per 100 or 1000 rows for fast imports, or one statement per row for easy debugging.

Safe quoting

Apostrophes are doubled (O''Brien), MySQL backslashes are escaped and empty cells become NULL.

FAQ

Common questions

Which databases are supported?

MySQL and MariaDB, PostgreSQL, SQLite and Microsoft SQL Server. Pick the dialect and the identifier quoting, boolean values and column types follow it.

How are column types chosen for CREATE TABLE?

Each column is inspected: whole numbers become INT (BIGINT when large), decimals DOUBLE, true/false BOOLEAN, ISO dates DATE or TIMESTAMP and everything else VARCHAR sized to the longest value. Review the result before using it in production.

What happens to empty cells?

Empty cells are written as NULL. Values such as 007 or 0123 keep their leading zeros because they are kept as text.

Is my CSV uploaded?

No. The conversion runs entirely in your browser, so customer lists and exports never leave your device.