CSV to SQL Converter

Paste CSV data to get CREATE TABLE and INSERT statements for your database. Column types are detected from the data.

Advertisement

Convert CSV to SQL INSERT statements

Spreadsheets and exports from tools like Excel, Google Sheets or a CRM usually come out as CSV. This converter reads the CSV, uses the first row as column names, and writes a ready-to-run SQL script you can paste into phpMyAdmin, pgAdmin, SSMS, DBeaver or the command line.

Each column gets a type based on its values — whole numbers become INT, decimals become DECIMAL, true/false becomes BOOLEAN and YYYY-MM-DD values become DATE. Values with leading zeros, such as zip codes or phone numbers, stay as text so the zeros are not lost. Empty cells become NULL and single quotes are escaped for you.

Example

CSV input:

id,name,email,signup_date,active
1,"Khan, Sara",sara@example.com,2026-03-14,true
2,Ali Raza,ali@example.com,2026-04-02,false

SQL output for MySQL with the table name customers:

CREATE TABLE `customers` (
  `id` INT,
  `name` VARCHAR(255),
  `email` VARCHAR(255),
  `signup_date` DATE,
  `active` BOOLEAN
);

INSERT INTO `customers` (`id`, `name`, `email`, `signup_date`, `active`) VALUES
(1, 'Khan, Sara', 'sara@example.com', '2026-03-14', TRUE),
(2, 'Ali Raza', 'ali@example.com', '2026-04-02', FALSE);

Options

  • Database — MySQL, PostgreSQL, SQL Server, SQLite or Oracle. This sets how names are quoted, which column types are used and how TRUE/FALSE are written.
  • Rows per INSERT — groups rows into multi-row INSERTs for faster imports. SQL Server is capped at its limit of 1000 rows; Oracle gets one INSERT per row.
  • CREATE TABLE — turn it off if the table already exists and you only need the INSERTs.
  • Delimiter — commas, semicolons, tabs and pipes are detected automatically.

Frequently asked questions

Can I convert an Excel file?
Yes. In Excel or Google Sheets choose File → Save as / Download → CSV, open the file in a text editor and paste its contents here.
What if my values contain commas or quotes?
Standard CSV quoting is supported: a value wrapped in double quotes may contain commas, line breaks and doubled quotes (""), and it is converted correctly.
My CSV has no header row. What happens?
Untick “First row is header” and the columns are named column_1, column_2 and so on. You can rename them in the generated CREATE TABLE.
Are the detected column types always right?
They are a starting point based on the values in your file. Review the CREATE TABLE before running it — for example, you may want a longer VARCHAR or a primary key.
Is my data uploaded?
No. The conversion runs entirely in your browser, so your CSV data never leaves your computer.

Related tools