Convert CSV to SQL INSERT statements

Turn CSV rows into escaped SQL INSERT statements locally with configurable table and batch size. Quotes inside values are escaped so the statements will run.

Drop your CSV file here or click to choose a file CSV file · processed on this device

CSV to SQL in three steps

FileGizmo turns CSV rows into SQL INSERT statements without uploading the source data. Choose a CSV file, enter the destination table name, select a batch size, and decide whether simple numbers, booleans, and nulls should be inferred. The generated script quotes identifiers, escapes embedded single quotes, and groups multiple rows into each statement for more practical imports.

SQL dialects differ, so the output uses conservative INSERT INTO syntax rather than database-specific bulk loaders. A CREATE TABLE can be included with it, and its column types are read from the rows in the file you gave it: whole numbers become INTEGER, anything carrying a decimal becomes NUMERIC, true and false become BOOLEAN, and everything else stays TEXT. A leading zero or plus sign on a whole number keeps the column TEXT, because 02134 as a number is 2134. That is a guess made from one file, and the statement says so in a comment above itself, because a column whose first thousand rows are whole numbers is not a promise about the thousand after them. Identifiers are double quoted, which PostgreSQL and SQLite accept and MySQL does not unless ANSI_QUOTES is set. Column names come from the CSV header and are quoted safely. Empty values can remain empty strings or become NULL when inference is enabled. Numeric inference accepts only finite decimal values and avoids evaluating formulas or executable content. The browser worker parses large CSV files in chunks and reports progress while building the script. Review the preview and run imports inside a transaction or staging database first. FileGizmo cannot know your constraints, indexes, reserved-word rules, or conflict policies, so production database validation remains the user’s responsibility.

  1. 1

    Choose a CSV file

  2. 2

    Enter a safe table name and batch size

  3. 3

    Generate preview and download the SQL script

Frequently asked questions

Which SQL databases are supported?

The syntax is deliberately conservative. Identifiers are double quoted, which PostgreSQL and SQLite accept and MySQL accepts only with ANSI_QUOTES set.

How are values escaped and typed?

Single quotes inside values are doubled per standard SQL. With inference on, a value is written unquoted only when every filled value in its column is a plain number or a boolean, blank cells become NULL, and codes such as 007, 02134 or +44 stay quoted.

Can it write the CREATE TABLE as well?

Optionally, yes. Column types are inferred from the rows in the file and the statement says so in a comment, because one file is a sample rather than a schema.

Is CSV data uploaded?

No. Parsing and SQL generation run locally in a browser worker.

Related guides

How to convert Excel to CSV without breaking your dataExport an XLSX worksheet to CSV while protecting leading zeros, long IDs, dates, Unicode text, delimiters, formulas, and row integrity.Matching two CSV exports without a databaseTwo files, one shared column, and a question neither answers alone. What a lookup formula costs, where it breaks, and when a join is the shorter road.