CSV to SQL
Convert CSV to SQL INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server, with an optional CREATE TABLE and batched inserts. Free, runs in your browser.
Runs in your browser. Nothing is uploaded.
About CSV to SQL
CSV to SQL turns a spreadsheet into INSERT statements you can run in your database. The header row gives the column names, numbers are written unquoted, text is quoted with single quotes doubled for escaping, and empty cells can become NULL.
Pick your dialect so identifiers are quoted the right way: backticks for MySQL, double quotes for PostgreSQL and SQLite, square brackets for SQL Server. Tick Add CREATE TABLE to get a table definition with column types guessed from the data (integer, decimal or text).
Batching several rows into each INSERT makes big imports much faster. Values with leading zeros, like 007, are kept as text.
How to use CSV to SQL
- Type or paste your text into the input box. Press Sample to see an example.
- Adjust the options. The result updates as you type.
- Copy the result, or press Use as input to chain another transformation.
Frequently asked questions
How are column types chosen?
A column with only whole numbers becomes an integer type, numbers with decimals a decimal or float type, and anything else text. Review the CREATE TABLE before running it.
Is it safe from SQL injection?
Single quotes in values are escaped by doubling them, which is the standard SQL rule. Still, review generated SQL before running it on production data.
Is CSV to SQL free and private?
Yes. CSV to SQL is completely free with no sign-up. Everything runs in your browser, so whatever you type or paste never leaves your device.