Search tools

Find a tool by name or what it does.

CSV to SQL Insert

Paste CSV or TSV and get ready-to-run SQL INSERT statements, with header-based columns, smart value quoting, and an optional CREATE TABLE.

The first row is used as column names. Everything runs in your browser and nothing is uploaded.

Options

SQL dialect

Statement style

Schema

How to convert CSV to SQL insert statements online

  1. Paste your CSV or TSV

    Paste comma or tab separated data into the input, with the first row holding the column names.

  2. Choose the SQL options

    Set the table name, pick MySQL, PostgreSQL, or plain quoting, and choose between multi-row inserts or one statement per row.

  3. Copy the SQL

    The INSERT statements update live as you type, so copy the script or download it as a .sql file.

Why use this tool

Runs as you type

There is no run button. Every edit rereads the data and rebuilds the SQL script instantly.

Smart value quoting

Numbers and empty cells become unquoted values and NULL, while text is wrapped in single quotes with any embedded quote escaped.

MySQL and PostgreSQL quoting

Identifiers are wrapped in backticks for MySQL or double quotes for PostgreSQL, or left plain, and column names are sanitized into valid identifiers.

Optional CREATE TABLE

Turn on schema output to prepend a CREATE TABLE with a type inferred for each column, covering integers, decimals, booleans, dates, and text.

Batched or per-row inserts

Group many rows into multi-row INSERT statements with a batch size you choose, or emit one INSERT per row.

Your data stays on your device

The whole conversion happens in your browser, so a spreadsheet full of records is never uploaded anywhere.

About this tool

This tool converts CSV and TSV data into SQL INSERT statements. The first row supplies the column names, and every row after it becomes a set of values. Each field is quoted the way SQL expects: text is wrapped in single quotes with any embedded quote doubled, whole numbers and decimals are left unquoted, and empty cells become NULL. Column names are sanitized into valid identifiers, so a header like Order Total turns into Order_Total.

You control the output as you go. Name the target table, choose MySQL backticks, PostgreSQL double quotes, or plain identifiers, and switch between one INSERT per row or multi-row statements batched to a size you set. Turning on CREATE TABLE adds a schema block with a type guessed for each column, covering integers, decimals, booleans, dates, and text. It handles the awkward cases too: values with leading zeros stay quoted so zip codes and IDs are preserved, and short rows are padded out to the header. To go the other way or inspect the data first, try CSV to JSON.

Database exports and spreadsheets often hold names, emails, and order history, so it matters that the conversion runs entirely in your browser and nothing is uploaded. Paste an export and get a script you can run against a local database in seconds. Once you have the statements, the SQL formatter can re-indent them to match your house style.

Frequently asked questions

How does the CSV to SQL converter work?
Paste CSV or TSV and the SQL updates live as you type. The first row is read as the column names and each remaining row becomes an INSERT with matching values. The delimiter is detected automatically, so comma and tab separated data both work.
Which SQL dialects are supported?
You can quote identifiers for MySQL with backticks, for PostgreSQL with double quotes, or leave them plain. The dialect also picks the column type names used in the optional CREATE TABLE, such as INT versus INTEGER.
How are values quoted and escaped?
Text values are wrapped in single quotes and any single quote inside is doubled so the statement stays valid. Whole numbers and decimals are left unquoted, empty cells become NULL, and values with leading zeros stay quoted so zip codes and IDs keep their exact form.
Can it generate a CREATE TABLE statement?
Yes. Turn on Include CREATE TABLE and a schema block is added above the inserts, with a column type inferred from your data: integers, decimals, booleans, dates, timestamps, or sized text columns.
Is my data uploaded anywhere?
No. The conversion runs entirely in your browser. Your data never leaves your device, is never sent to a server, and is not stored or logged.
Is there a limit on how many rows it can convert?
Very large inputs are converted up to the first 20,000 rows to keep the page responsive, and a note tells you when that happens. For a bigger load you can split the data and run the tool in batches.

Related tools