Skip to content

Install ALink Tools

Free browser tools for images, PDFs, media, text and web checks. Most tools process files locally on your device.

  1. Tap the Share button in the Safari toolbar.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. ALink Tools then opens from your Home Screen like an app.

CSV to SQL

Paste a comma-separated CSV file and get INSERT statements in this tab. Table and column names are quoted. Every cell is written as a SQL string, including numbers and the word NULL. The SQL is not executed here. Nothing is uploaded.

Runs in your browserPapa Parse (MIT)Runs in your browserNothing is uploaded
1

Input

2

Result

How to use CSV to SQL

  1. Paste or open CSVType, paste, or open a comma-separated .csv file with a header row. The limit is 1 MB, 1,000 rows, and 128 columns.
  2. Name the tableEnter a table name, optionally a schema name, and choose PostgreSQL or SQLite. Identifiers are quoted.
  3. Copy or downloadCopy the INSERT statements or download insert-statements.sql. The SQL is not run in this tab.

Limits and how it works

  • The input is limited to 1 MB of UTF-8 text, including files you open, 1,000 data rows, 128 columns, 63 bytes per identifier, and 4 MB of generated SQL.
  • Only comma-separated CSV with a header row and at least one data row is accepted. Tabs and semicolons are not detected automatically. Duplicate headers and rows with the wrong number of columns are rejected.
  • Identifiers may not be empty, contain a NUL or control character, or exceed 63 bytes.
  • Only PostgreSQL and SQLite dialects are offered. The SQL is not executed here.

How CSV becomes SQL

This page reads comma-separated CSV with Papa Parse 5.7.1 (MIT) and writes INSERT statements with generateSqlInserts, the same helper already used under Generate SQL INSERT statements on JSON Formatter and SQL Formatter. Those pages also accept a JSON array of objects. This page is the dedicated CSV entry.

Identifiers — schema, table, and column names — are wrapped in double quotes, and a quote inside a name is doubled. Schema and table are separate fields; a dot in a name stays part of that identifier. String values use SQL quotes: PostgreSQL statements use E'…' escape strings so they do not depend on standard_conforming_strings, and SQLite uses standard quoted strings. A quote in a value is doubled. Backslashes and line breaks are escaped in the PostgreSQL form.

CSV cells are not type-inferred. Digits, empty cells, and the word NULL all stay strings. The statements are text only — this tab does not connect to a database or run the SQL. Check that the column types on your target table accept these strings, or edit the statements before you run them.

Frequently asked questions

Is my CSV uploaded?

No. Everything runs in your browser tab with JavaScript. Nothing you type, paste, or open is sent to a server, logged, or stored by ALink Tools.

Is this the same as the box on JSON Formatter or SQL Formatter?

Yes for CSV. Those pages use the same converter under Generate SQL INSERT statements, and they can also start from a JSON array of objects. This page is the dedicated CSV entry.

Why did the number 1 become '1'?

Every CSV cell is written as a SQL string so a value is not guessed as a number or as SQL NULL. The word NULL and empty cells stay strings too. You can edit a literal after you download the file if your column needs another type.

Can I use this with MySQL?

Not as a preset. The quoted identifiers and string literals are written for PostgreSQL or SQLite. MySQL quoting is different, so these statements may not be safe to run there without changes.

Related tools

All tools