Data Tools

CSV to SQL Converter

Convert CSV to SQL right in your browser — nothing is uploaded. Importing a spreadsheet into a database is often simplest as a script of INSERT statements you can review first.

By Aditya Kr Sharma Files stay on your device

  • Free
  • Instant
  • No sign-up

CSV to SQL converter

Convert

Or import from
Supports: CSVTSVTXT

Nothing is uploaded. This tool runs entirely in your browser, so the file never leaves your device. There is no server to send it to, no copy kept anywhere, and it keeps working if you lose your connection after the page has loaded.

Accepts .csv .tsv .txt You get: A .sql script Free, no sign-up

How to convert

  1. Add your files Drag them in, choose files, or use the camera.
  2. Check the settings The defaults suit most files.
  3. Download Save one file, or all of them as a ZIP.

How to convert CSV to SQL

  1. Drop your CSV file on the box above, or paste its content into the text box.
  2. Check the settings below the box; the defaults suit most files.
  3. Press Convert. You see a preview or a summary of the result.
  4. Download the .sql file, or copy the text.

What is kept when you convert CSV to SQL

  • A CREATE TABLE statement uses the headers as column names, with INTEGER/BIGINT, exact DECIMAL(p,s) or TEXT types inferred from the data.
  • Values are escaped for the chosen database (MySQL, PostgreSQL, SQLite, SQL Server); rows are grouped into multi-row INSERTs of up to 500.
  • Empty cells can become NULL, and numbers are only left unquoted when every value in the column is a plain number.

Example

A short CSV input and the exact output this tool produces from it:

Input

name,city,score
"Smith, John",London,42
Anna,"New ""York""",7.5

Output

CREATE TABLE `people` (
  `name` TEXT,
  `city` TEXT,
  `score` DECIMAL(3,1)
);

INSERT INTO `people` (`name`, `city`, `score`) VALUES
('Smith, John', 'London', 42),
('Anna', 'New "York"', 7.5);

About CSV and SQL files

CSV (comma-separated values) is a table as plain text: one row per line, fields separated by commas, and fields that contain commas, quotes or line breaks wrapped in double quotes. It opens in Excel, Google Sheets, LibreOffice, any database tool.

A .sql file is a script of statements — here a CREATE TABLE and INSERT statements — that a database runs to create and fill a table. It opens in MySQL, PostgreSQL, SQLite, SQL Server and their clients.

Good to know

  • If a spreadsheet showed all your data in one column, the file probably uses semicolons (common in Europe); choose the delimiter instead of relying on detection.
  • Run the script inside a transaction (BEGIN … COMMIT) on a test database first, so a mistake can be rolled back.

Privacy and limits

The file is read and converted by this page in your browser; there is no upload and no account. Files up to 25 MB are accepted; a file of the wrong type or a damaged file is rejected with the reason.

Frequently asked questions

Is the SQL safe from injection?

Every value is a quoted literal escaped for the chosen dialect, and identifiers are quoted too, so a cell containing quotes or SQL keywords is stored as text. Our tests load the output into a real SQLite database.

Why DECIMAL and not FLOAT?

DECIMAL stores money and measurements exactly; FLOAT would round them. The precision is calculated from your data.

Is my file uploaded to a server?

No. The conversion runs in your browser on your own device, and this page has no upload endpoint.

Is there a size limit?

One file of up to 25 MB at a time (about 2 million cells). Larger files can exhaust a browser tab’s memory, so the tool refuses them with a message instead of failing halfway.

More in Data Tools All tools