CSV to SQL INSERT Converter

Convert CSV or TSV to SQL INSERT statements for an existing PostgreSQL or SQLite table. Preview, copy, or download the .sql file in your browser.

CSV input

CSV and table options

SQL INSERT output

Generate SQL to preview the INSERT statements.

Convert CSV rows to SQL INSERT statements

Paste your data or open a local UTF-8 CSV or TSV file. Choose SQLite or PostgreSQL, enter your destination table, and select Generate SQL. The converter reads commas, semicolons, or tabs. Choose the delimiter yourself if automatic detection picks a different one. Preview the generated INSERT statements, copy them, or download a .sql file. Conversion happens in your browser.

Match an existing database table

Enter the table name as it appears in your database. Use the optional schema field to qualify it, for example with public in PostgreSQL. When the first CSV record contains column names, those names determine which columns receive each field. For a file without headers, turn off that option and put the fields in the destination table’s column order. Every data record should have the same number of fields.

Preserve text values and handle empty fields

The converter quotes each field as text, including values like 0012, names like O'Connor, and text with embedded line breaks. The destination column types determine how the database stores those values. For a text column, 0012 retains its leading zeros. Empty fields become empty strings by default. Enable Write empty fields as NULL to insert SQL NULL instead.

Show more related tools