CSV to SQL Converter Online – INSERT, UPDATE & CREATE TABLE

Paste or upload a CSV and get SQL for MySQL, PostgreSQL, SQLite or SQL Server. Free, instant, and private: nothing is uploaded.

SQL output

Rows converted: 0

By ConvertsFiles Admin · Updated October 2026

How to convert CSV to SQL online

  1. Paste your CSV or upload a .csv, .tsv or .txt file.
  2. Type the table name and pick your SQL dialect: MySQL, PostgreSQL, SQLite or SQL Server.
  3. Choose INSERT or UPDATE. For UPDATE, enter the primary key column.
  4. Tick Generate CREATE TABLE if the table does not exist yet.
  5. Copy the SQL or download it as a .sql file and run it in your database.

What this converter handles correctly

  • Quoted fields, commas inside quotes, doubled quotes and line breaks inside a field (RFC 4180 style)
  • Windows line endings and the invisible BOM that Excel adds to UTF-8 files
  • Delimiter auto-detection for comma, semicolon, tab and pipe files
  • Values such as ZIP codes and phone numbers with leading zeros (01234) stay text, so they are not turned into numbers
  • Identifier quoting and string escaping for each dialect, including backslashes in MySQL
  • Empty, duplicate and special-character column names are renamed so the SQL stays valid

INSERT or UPDATE?

INSERT adds new rows. UPDATE changes existing rows and needs a unique key. With id as the key, this CSV:

id,name,email
1,Ali,ali@test.com

produces (MySQL):

UPDATE `my_table` SET `name`='Ali', `email`='ali@test.com' WHERE `id`=1;

SQL to CSV

Switch to the SQL to CSV tab and paste INSERT INTO … VALUES statements. The tool reads single and multi-row inserts, quoted strings and NULLs, and returns a CSV with your choice of separator.

Good to know

  • Column types in CREATE TABLE are a guess based on the first 2,000 rows. Review them before you run the script.
  • DROP TABLE is off by default because it deletes existing data.
  • Excel files (.xlsx) are not read directly. Save the sheet as CSV first.
  • Very large files depend on your browser memory. For big output, use Download instead of Copy.
  • Always test generated SQL on a copy of your database first.

Frequently asked questions

How do I convert a CSV file to SQL?

Paste the CSV or upload the file, enter a table name, choose your SQL dialect and click Convert. Copy the INSERT statements or download the .sql file and run it in your database.

How do I convert a CSV to a table?

Tick Generate CREATE TABLE, convert, and run the script. It creates the table with guessed column types, then fills it with INSERT statements.

How do I query a CSV file in SQL?

Import it into a table first. This tool creates the CREATE TABLE and INSERT statements, and then you can use SELECT. Tools like DuckDB and the SQLite .import command can also read CSV files directly.

Which databases does it support?

MySQL and MariaDB, PostgreSQL, SQLite and SQL Server. The dialect setting changes identifier quoting, string escaping and column type names.

How do I generate SQL UPDATE statements from a CSV?

Select UPDATE and enter the unique key column, such as id or email. Each CSV row becomes an UPDATE with that column in the WHERE clause.

Why are my leading zeros kept?

Values like 007 or 01234 would lose their zeros as numbers. The converter writes them as quoted text so ZIP codes, phone numbers and IDs stay correct.

Is my data uploaded anywhere?

No. The conversion runs in your browser with JavaScript. Your CSV and SQL never leave your device.

Is the CSV to SQL converter free?

Yes. It is free for personal and commercial use, with no sign-up.

More free tools

© 2026 ConvertsFiles.com. All processing happens in your browser.
Featured on LaunchBuff OpenHunts Club Member Proudly listed on Launchpadly Startup Directory
Scroll to Top
convertsfiles

convertsfiles

40+ free tools: PDF, image converter & calculators

Check it out on Product Hunt →