Neatbo.

CSV to SQL INSERT

Generate reviewable PostgreSQL or MySQL INSERT scripts from CSV for an existing table.

Browser-local processingInputCSVOutputSQLUp to 10 MiB per file · File limit: 1
  1. 1Add input
  2. 2Adjust settings
  3. 3Get your result

Tool input and files are processed in this browser without being uploaded.

Your input

Inputs are kept temporarily in this tab when switching tools. Refreshing or closing clears them; large results may need to be regenerated.

⌘ / Ctrl + Enter to run
Delimited text source
0 characters · 0 bytes

Prepare INSERT script

Use a CSV header row that matches columns in an existing table. The preview shows how rows and empty cells will be handled.

Database syntax

Headers are trimmed, then quoted as column names. All nonblank cells become text literals; no table is created or query executed.

Paste CSV or choose a UTF-8 CSV/TSV/TXT file to begin.

Preparing the tool…

Before you start

Turn CSV rows into an INSERT script for an existing table. Choose the database syntax, separator and empty-cell policy before checking a data sample and saving the script.

How to use this tool

  1. Paste CSV with a header row or choose one UTF-8 CSV, TSV or TXT file.
  2. Choose PostgreSQL or MySQL, the CSV separator, target table and whether blank cells mean empty strings or SQL NULL.
  3. Check row, column and blank-cell counts and the CSV sample; then generate, review, copy or download the complete SQL script.

Supported inputs and limits

CSV headers must match columns in an existing table. Headers are trimmed; one or two table-name parts are quoted. No table is created or database connection made.

All nonblank cells become text literals. Blank cells become empty strings or SQL NULL by choice; literal "NULL" stays text. Check target column types and constraints before executing.

PostgreSQL backslashes and line breaks use E-string escapes. MySQL values containing backslashes or line breaks use UTF-8 hexadecimal literals to avoid SQL-mode-dependent interpretation; target connection must accept UTF-8.

Up to 200,000 CSV cells and 1,000 columns; paste is limited to 1 MiB, one UTF-8 file to 10 MiB and SQL output to 20 MiB. Each INSERT has at most 500 rows.

Worked example

Example input

name,age
Mori,3
Example options
{"table":"records","dialect":"postgres"}

Example output

INSERT INTO "records" ("name", "age") VALUES
('Mori', '3');

When something does not work

Fix malformed CSV, mismatched row widths or duplicate headers before generating. Review the complete script and target schema before running it in a database.

Frequently asked questions

Does this create a table or import data?

No. It generates INSERT text for an existing table and never connects to or changes a database. Match its headers to your target columns before running it.

How are empty cells and types handled?

Choose empty string or SQL NULL for truly blank cells. All other CSV fields are quoted text, including numbers and the word NULL; your database must accept them for the target column types.

Is my input sent to a server?

No. Tool input is processed in your browser, not sent to a server. Temporary workspaces stay in the same tab and are cleared by a refresh or tab closure. Save the results you need.

Documentation & further reading

Related tools