CSV Β· Excel Β· TSV β†’ SQL Free & Private

CSV & Excel to SQL Converter

Convert CSV, TSV or Excel files into SQL INSERT statements for MySQL, PostgreSQL, SQLite, SQL Server, MariaDB and Oracle. Auto-detects column types, supports batch inserts, upserts and transactions. Runs 100% in your browser no data leaves your device.

Input Data
Conversion Options
πŸ—„οΈ
Ready to convert

Paste or upload your CSV / Excel data, configure the options, then click Generate SQL.

SQL Dialect Reference

Free CSV to SQL Converter Online

The TOOLBeans CSV to SQL converter turns CSV, TSV and Excel spreadsheet data into ready-to-run SQL statements for any major database. Instead of writing INSERT statements by hand or wrestling with import wizards, you paste your data or drop in a file and the tool produces a clean, correct SQL script, complete with an optional CREATE TABLE schema, in a fraction of a second. It supports MySQL, PostgreSQL, SQLite, SQL Server, MariaDB and Oracle, and generates the right identifier quoting, data type names and INSERT syntax for whichever one you choose.

The converter reads each column and works out the most appropriate data type for it, recognising integers, decimals, booleans, dates, timestamps and text. You can then fine-tune the result in the Columns editor: rename a column, override the detected type, or exclude columns you do not want, all before generating the SQL. Empty cells are turned into proper NULL values, string values are safely escaped to prevent broken statements, and you can wrap everything in a transaction so the whole import succeeds or fails as one unit.

Everything happens entirely in your browser. Your spreadsheets, which often contain sensitive customer or business data, are never uploaded to any server, which makes this a safe option even for confidential datasets. There is no account, no upload limit and no cost.

How to Convert CSV or Excel to SQL Step by Step

1
Paste or upload your data

Paste CSV or TSV text directly, or switch to Upload and drop in a .csv, .tsv, .txt, .xlsx or .xls file. Excel files are read in the browser using the first worksheet. Click Load Sample CSV to try it instantly.

2
Pick your database

Choose your target dialect: MySQL, PostgreSQL, SQLite, SQL Server, MariaDB or Oracle. The generated SQL uses the correct quoting, type names and syntax for that database.

3
Review and edit columns

The tool auto-detects each column type. Open the Columns tab to rename a column, change its SQL type, or exclude it from the output, so the schema matches exactly what you need.

4
Choose your options

Set the table name, decide whether to include CREATE TABLE, DROP IF EXISTS, an auto-increment primary key, and a transaction wrapper. Pick single, batch or upsert insert mode.

5
Generate the SQL

Click Generate SQL. The full script appears in the output panel with line and size counts, ready to review. Use the Data Preview and Column Schema tabs to double-check before running it.

6
Copy or download

Copy the SQL to your clipboard or download it as a .sql file, then run it in your database client, command line, or migration tool.

Single, Batch and Upsert Insert Modes

The right insert mode depends on how much data you have and whether the rows might already exist. Here is when to use each.

Single INSERT

One INSERT statement per row. The most compatible and easiest to read or debug. Ideal for small datasets, or when you want each row to be an independent, self-contained statement.

Batch INSERT

Many rows packed into each INSERT statement (the batch size is adjustable). Far faster for large datasets because the database processes fewer statements, with less round-trip overhead.

Upsert / Merge

Insert a row, or update it if a row with the same key already exists. The tool generates the correct form for your database: ON DUPLICATE KEY UPDATE (MySQL), ON CONFLICT (PostgreSQL), INSERT OR REPLACE (SQLite) or MERGE (SQL Server).

How Automatic Column Type Detection Works

For each column the tool examines every value and picks the most specific type that fits all of them, then maps it to the right name for your chosen database. If the detection is not quite what you want, the Columns editor lets you override any type manually.

Integer

Whole numbers like 28 or -1500 become INT or INTEGER, automatically promoted to BIGINT when values exceed the 32-bit range.

Decimal

Numbers with a decimal point like 75000.50 become DECIMAL or NUMERIC, suitable for money and measurements where precision matters.

Boolean

Columns containing only true/false, yes/no or 0/1 become the dialect boolean type, such as BOOLEAN, TINYINT(1) or BIT.

Date and timestamp

Values like 2024-01-15 become DATE, and values that also include a time become DATETIME, TIMESTAMP or the equivalent for your database.

Text

Anything else becomes VARCHAR sized to fit the longest value, or TEXT when the content is too long for a bounded varchar.

Supported Databases

🐬 MySQL

Backtick-quoted identifiers, INT/DECIMAL/DATETIME types, and ON DUPLICATE KEY UPDATE for upserts. The most widely used open-source database.

🐘 PostgreSQL

Double-quoted identifiers, SERIAL primary keys, NUMERIC and TIMESTAMP types, and ON CONFLICT for upserts. A powerful, standards-focused database.

πŸͺΆ SQLite

A simple, flexible type system (INTEGER, REAL, TEXT) and INSERT OR REPLACE for upserts. Perfect for local apps, prototypes and mobile.

πŸͺŸ SQL Server

Bracket-quoted identifiers, IDENTITY primary keys, NVARCHAR and DATETIME2 types, and MERGE statements for upserts. Microsoft’s enterprise database.

🦭 MariaDB

A MySQL-compatible fork, so it uses the same backtick quoting, type mapping and upsert syntax as MySQL.

πŸ”΄ Oracle

VARCHAR2 and NUMBER types, IDENTITY columns, and INSERT ALL for efficient multi-row inserts. A leading enterprise database.

Your Data Stays Private

Many online converters upload your file to a server to process it. This tool does not. All parsing and SQL generation runs locally in your browser using JavaScript, including reading Excel files. Your data never leaves your computer.

That matters because spreadsheets often hold sensitive information such as customer records, financial figures or internal business data. Because nothing is transmitted, you can convert confidential datasets without worrying about where they end up, and the tool keeps working even if your internet connection drops after the page has loaded.

Frequently Asked Questions

Is the CSV to SQL converter free?+
Yes. It is completely free with no usage limits, no account and no signup. Every feature, including Excel support, all six database dialects, the column editor, batch and upsert modes and SQL download, is available to everyone.
Does my data get uploaded to a server?+
No. All parsing and SQL generation runs entirely in your browser. Your CSV and Excel files never leave your device, so the tool is safe for confidential data.
Which databases and SQL dialects are supported?+
MySQL, PostgreSQL, SQLite, SQL Server (T-SQL), MariaDB and Oracle. Each one gets the correct identifier quoting, data type names and INSERT or MERGE syntax for that database.
Can I convert Excel files, not just CSV?+
Yes. Upload .xlsx or .xls files directly and the tool reads the first worksheet in your browser. CSV, TSV and plain delimited text files are also supported, and the delimiter is auto-detected.
Does it detect column data types automatically?+
Yes. It inspects every value in each column and chooses the most specific fitting type: integer, decimal, boolean, date, timestamp or text. You can override any type in the Columns tab if you need something different.
Can I rename columns or exclude some from the output?+
Yes. The Columns editor lets you rename any column, change its SQL type, and toggle individual columns off so they are left out of both the CREATE TABLE and the INSERT statements.
What is the difference between single, batch and upsert modes?+
Single mode writes one INSERT per row and is the most compatible. Batch mode packs many rows into each INSERT for much faster loading of large datasets. Upsert mode inserts or updates existing rows using the correct syntax for your database.
Will the SQL handle quotes and special characters safely?+
Yes. String values are escaped (single quotes are doubled and backslashes handled) so that apostrophes and other special characters do not break your INSERT statements.
How are empty cells handled?+
With the NULL for empty option enabled, blank cells become proper NULL values rather than empty strings, which is usually what you want in a database. You can turn this off if you prefer empty strings.
Is there a row limit?+
There is no hard limit, but because everything runs in your browser, extremely large files (hundreds of thousands of rows) depend on your device memory. For very large imports, batch mode and downloading the .sql file are recommended.