CSV to SQL INSERT

Convert CSV data to SQL INSERT statements — MySQL, PostgreSQL, SQLite

CSV Input

SQL Output

-- Generated by NKable.com CSV to SQL Converter
-- Table: users | Rows: 4 | Dialect: mysql

INSERT INTO `users` (`id`, `name`, `email`, `age`, `active`)
VALUES
  (1, 'Alice Smith', '[email protected]', 28, 1),
  (2, 'Bob Jones', '[email protected]', 34, 0),
  (3, 'Carol White', '[email protected]', 25, 1),
  (4, 'David Brown', '[email protected]', 41, 1);

About the CSV to SQL Converter

This tool converts CSV to SQL insert statements for MySQL, PostgreSQL or SQLite. Header names become column names, numeric columns stay unquoted, empty cells become NULL, and apostrophes inside values are escaped — all without the file leaving your browser.

Convert CSV to SQL when a spreadsheet has to become table rows: importing a supplier price list, loading reference data, or seeding a database from an export. Writing hundreds of INSERT statements by hand is exactly the kind of work worth automating.

The details that break hand-written imports are handled here. Header names become column names, numeric columns are emitted unquoted so they land in numeric fields, empty cells become NULL rather than the empty string, and apostrophes inside values are escaped so a name like O'Brien cannot terminate a statement.

Pick your dialect first — MySQL, PostgreSQL and SQLite differ in quoting and identifier rules. Conversion happens in your browser, so customer or financial data in the CSV stays on your machine.

How to use the CSV to SQL Converter

  1. Paste or upload the CSV. Provide the CSV data. The header row supplies the column names.
  2. Choose the dialect and table. Pick MySQL, PostgreSQL or SQLite and name the target table.
  3. Generate the SQL. Produce the INSERT statements from the parsed rows.
  4. Copy the statements. Copy the SQL and run it against your database.

CSV to SQL Converter features

  • Multiple database support
  • Auto table creation
  • Data type detection
  • Custom table names
  • File upload support
  • Syntax validation

Frequently asked questions

Where do the column names come from?

The CSV header row. Each header becomes a column name in the generated INSERT statements.

How are empty cells handled?

They become NULL rather than an empty string, which is usually what a database import should receive.

Are apostrophes in values escaped?

Yes. Quotes inside values are escaped so a name like O'Brien cannot terminate the statement early.

Which dialects can it target?

MySQL, PostgreSQL and SQLite, which differ in quoting and identifier rules.

Is my CSV sent to a server?

No. Conversion happens in your browser, so the data stays on your machine.