Skip to main content

CSV to SQL Insert

Convert CSV to SQL INSERT statements for PostgreSQL, MySQL or SQL Server, with an inferred CREATE TABLE and batches. Free and private.

More options

CSV

Stays in your browser

SQL

The result appears here after you press Convert.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to SQL Formatter.

Free Online CSV to SQL Insert

Turn spreadsheet rows into SQL you can run. Choose your database, name the table, and the tool writes a CREATE TABLE with guessed column types and INSERT statements in batches. It gives developers a quick browser-based way to solve a focused csv to sql insert task before moving the result into a project.

How to use CSV to SQL Insert

Paste your data into the box on the left, or open a file, then press Convert. The first row gives the column names. Types are guessed from the data: whole numbers, decimals, true/false, dates and text.

Common mistakes

  • Running the generated SQL without reading the guessed types: check the CREATE TABLE before using it on a real database.
  • Phone numbers and codes with leading zeros are detected as text only when a value is not a plain integer; review them.

Frequently asked questions

How are column types chosen?
The tool looks at every value in a column: all whole numbers give INTEGER (or BIGINT), numbers with decimals give a decimal type, true/false give a boolean, ISO dates give DATE or a timestamp, and anything else is text.
Are quotes in text handled?
Yes. A single quote is doubled, and in MySQL backslashes are escaped too. Empty cells become NULL.
Why batches?
Very large single statements can exceed a database limit. "Rows per INSERT" splits them: 500 is a safe default.
Is my data uploaded anywhere?
No. The conversion runs in your browser and nothing you paste or open is sent to a server.
How do I use this csv to sql insert tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Formatters & Parsers

View all Formatters & Parsers tools →