CONVERTER / CSV → SQL
CSV to SQL INSERT Generator
Generate one SQLite-compatible INSERT statement per CSV record for an existing table. Keep values as text, then copy or download SQL. Your data stays in your browser.
How to generate INSERT statements from CSV
Paste CSV or open a UTF-8 file, enter Table name, and optionally enable Empty Cells as NULL. Choose Generate SQL, then Copy or Download converted.sql. The table must already exist and its columns must match your CSV headers. This tool does not create a table, connect to a database or execute SQL.
Input limits
Use up to 5 MB per input with unique, non-empty headers and consistent records. SQL output is limited to 25 MB of UTF-8, including repeated identifiers and escaped quotes. NUL and invalid Unicode are rejected. Use fewer records or shorter identifiers if the result is too large.
CSV to SQL example
id,name,note
001,Alex O'Brien,"Hello, world"
002,Олена,"First line
Second line"
003,Sam,INSERT INTO "users" ("id", "name", "note") VALUES ('001', 'Alex O''Brien', 'Hello, world');
INSERT INTO "users" ("id", "name", "note") VALUES ('002', 'Олена', 'First line
Second line');
INSERT INTO "users" ("id", "name", "note") VALUES ('003', 'Sam', '');
Frequently asked questions
- Which database and table structure does this support?
- The output uses SQLite-compatible syntax with double-quoted identifiers and single-quoted text literals. The table must already exist with matching column names. No CREATE TABLE is generated. Dots in Table name belong to one identifier, not a schema name. CSV headers follow the existing parser: outer spaces are trimmed and blank records are skipped. Headers differing only in ASCII case are rejected because SQLite cannot treat them as distinct columns.
- Are IDs, quotes, multiline values or empty cells changed?
- There is no automatic number, boolean or date detection: 001 and large integers are quoted text. Apostrophes in values and double quotes in identifiers are doubled; backslashes, Unicode and uploaded cell line endings stay literal in Copy and Download. The editor previews normalize CRLF and CR to LF for display; editing the input uses the displayed text as the new source. Empty cells become empty text by default. Empty Cells as NULL converts only exactly empty cells to unquoted NULL; spaces and the text null stay text. Use TEXT columns in the target table when preserving IDs is important: database column types and constraints can convert or reject inserted values.
- What happens with headers only, and when are results reset?
- Header-only CSV returns a fixed SQL comment with zero data rows and zero INSERT statements; Columns still counts the headers. Editing CSV, Table name or Empty Cells as NULL clears old output and disables Copy/Download. Use example loads the users table with the option off. Clear empties the CSV, restores csv_data and turns the option off. SQL is displayed as text and is never executed or uploaded by this tool.