CSV to SQL Converter

CSV to SQL Converter

Paste CSV data and get SQL INSERT statements for your table. The first row is used as the column names, empty cells become NULL, and single quotes are escaped properly.

Your SQL INSERT statements will appear here.

About the CSV to SQL Converter

The CSV to SQL Converter turns spreadsheet data into SQL INSERT statements you can run in your database. Paste CSV text, give the table a name, and the tool writes one INSERT statement per row, using the first row as the column names.

It parses CSV properly: fields wrapped in double quotes can contain commas, line breaks, and doubled double quotes. Empty cells become NULL, plain numbers stay unquoted, and text values are wrapped in single quotes with any single quote inside doubled, which is the standard SQL way to escape it.

How to use

  1. Paste your CSV in the box. The first row must contain the column names.
  2. Type the name of the table the rows belong to.
  3. Click Convert to SQL.
  4. Use Copy SQL to copy the statements, or Download .sql to save them as a file.

Key features

  • One INSERT statement per row, with the header row used as column names
  • Proper CSV parsing, including quoted fields with commas and line breaks
  • Single quotes escaped by doubling, and empty cells turned into NULL
  • Numbers left unquoted, text safely quoted
  • Copy and download as a .sql file

Frequently asked questions

Does the first row have to be the header?

Yes. The first row is always read as the column names. If your CSV has no header row, add one first, for example name,email,age.

What happens to empty cells?

An empty cell becomes NULL in the INSERT statement, so the database stores a real null value instead of an empty string.

How are names with apostrophes handled?

A single quote inside a value is doubled, so O’Brien becomes ‘O”Brien’ in the SQL. That is the standard SQL escape, and it keeps the statement valid.

What table names are allowed?

The table name must start with a letter or underscore and contain only letters, numbers, and underscores, for example customers or order_items. Anything else is rejected with a clear message.

Can a field contain a comma?

Yes, as long as the field is wrapped in double quotes, for example “Lovelace, Ada”. The parser keeps quoted commas inside the field instead of treating them as separators.

Is my data uploaded anywhere?

No. The conversion runs entirely in your browser and your CSV is never sent to a server.

Free to use, no signup needed. This tool runs entirely in your browser — your data never leaves your device.