CleanCSV

Convert CSV to SQL INSERT Statements

Turn a CSV or spreadsheet into a ready-to-run SQL script: a CREATE TABLE with detected column types and batched INSERT statements for your database.

Free, no sign-upFiles never leave your deviceCSV, Excel & JSON

CSV to SQL converter

No account. No uploads. Just clean data.

100% in your browser
1

Upload your file

Drop your CSV or Excel file here

or browse your device. You can select several files at once.

CSV, TSV, TXT, XLSX, XLS, ODS and JSON · up to 50.0 MB and 250,000 rows

Your files never leave your device.

Step by step

How to use this tool

  1. 1

    Drop a CSV, Excel or JSON file into the tool above.

  2. 2

    Optionally clean the data and rename columns; the snake_case header style gives database-friendly column names in one click.

  3. 3

    SQL is already selected. Pick your database and a table name, then click Download SQL.

  4. 4

    Run the .sql file in your database client, for example psql, the mysql command line, SQLite or SQL Server Management Studio.

What the script contains

A CREATE TABLE statement followed by INSERT statements with 500 rows each, so large files load quickly without hitting statement size limits. Column names come from your header row and are quoted, so spaces and reserved words are safe.

Column types

Each column gets the narrowest type that fits every value: BIGINT for whole numbers, NUMERIC or DECIMAL for decimals, BOOLEAN (BIT on SQL Server) for true/false, DATE for YYYY-MM-DD dates and TEXT (NVARCHAR(MAX) on SQL Server) for everything else. Empty cells in typed columns become NULL, and values with leading zeros, such as zip codes, stay text.

Escaping and safety

Text values are quoted with embedded quotes doubled, backslashes are escaped for MySQL, and SQL Server strings use the N prefix for Unicode. Review the script before running it against a production database, and consider loading into a new table first.

Frequently asked questions

Which databases are supported?

PostgreSQL and SQLite (standard SQL with double-quoted names), MySQL and MariaDB (backtick-quoted names) and SQL Server (square brackets). The output is plain SQL text, so most other databases accept it with small changes.

Can I convert Excel to SQL?

Yes. Upload an .xlsx, .xls or .ods file, pick the sheet and download SQL.

Can I split a big file into several SQL scripts?

Yes. Turn on Split into multiple files to get a ZIP of SQL files. Only the first part creates the table, so run the parts in order.