Runs in your browser

CSV to SQL

Generate CREATE TABLE and INSERT statements from CSV or Excel for MySQL, PostgreSQL, SQLite or SQL Server.

Part of the File Converter bot
Processed in your browser
1

Your data

2

SQL options

Database
Table name
Rows per INSERT
Empty cells
Include
Column types (detected from your data)
3

SQL

About the CSV to SQL Converter

This CSV to SQL converter turns CSV or Excel data into a CREATE TABLE statement with detected column types and batched INSERT statements, written correctly for MySQL, PostgreSQL, SQLite or SQL Server with safe quoting and escaping.

How to use the CSV to SQL Converter

  1. Drop a CSV or Excel file, or paste cells from a spreadsheet.
  2. Pick your database and table name. Column types are detected from the data, and you can change any of them.
  3. Copy the SQL or download it as a .sql file, then run it in your database tool.

CREATE TABLE and INSERT, ready to run

Get a CREATE TABLE statement with sensible types (INTEGER, DECIMAL, DATE, BOOLEAN, VARCHAR or TEXT) and INSERT statements for every row, batched so big files import quickly.

Written for your database

Identifiers are quoted the way each database expects (backticks for MySQL, double quotes for PostgreSQL and SQLite, brackets for SQL Server), quotes and backslashes in values are escaped safely, and SQL Server gets N'…' strings for non-English text.

Clean column names

Headers like "Signup Date" or "Spend (₹)" become signup_date and spend, so you don't have to quote them in every query.

Questions

Is my data uploaded?

No. The SQL is generated in your browser, on your device.

How are types chosen?

A column becomes INTEGER or DECIMAL only if every filled value is a number, DATE if every value is a date in YYYY-MM-DD form, BOOLEAN for true/false columns, otherwise VARCHAR or TEXT sized to the longest value.

Can I import Excel files?

Yes. Open an .xlsx file, pick the sheet, and generate SQL in the same way.

Is it safe against SQL injection?

Values are escaped for the database you choose, so quotes and backslashes inside your data can't break out of the strings. Still, check generated SQL before running it on important databases.

Also searched as: convert csv to insert statements · csv to mysql · csv to postgresql · excel to sql insert · csv to sqlite · generate create table from csv