Table to SQL Insert Generator

Turn a bounded table into quoted SQL insert or upsert statements using explicit column types and a selected dialect.

Files stay on your device No sign-up Free to use
How this works

The tool runs in this browser. Your file or text is not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

Privacy details

Generate output controls

A heading row and up to 100,000 data rows. Clear this box to choose a file.

Drop your table file here

or choose one from your device

One file, up to 20 MiB. XLSX reads stored cell values and never calculates formulas.

    Optional worksheet name or 1-based number. Blank uses the first visible worksheet.

    One table identifier, not a SQL expression or a schema-qualified path.

    Map headings to text, number or boolean. Unlisted columns remain text, including leading zeroes.

    Group 1 to 500 rows into each INSERT statement. The final group may contain fewer rows.

    Comma-separated headings. PostgreSQL/SQLite need an existing matching unique key. MySQL/MariaDB reacts to any primary or unique key.

    Processed in your browser. Your inputs stay on this device.

    Showing a generated example. Generate again for a new result.

    How to use Table to SQL Insert Generator

    1. Paste a table or select a supported file and sheet.
    2. Choose a dialect, table name, column types and insert or upsert.
    3. Review the generated source before using it with your database.

    Example: Table to SQL Insert Generator

    Generate one typed insert.

    You add
    CSV: name,age Ada,36. Table name: people; dialect: MySQL/MariaDB; types: {"age":"number"}; mode: INSERT; batch size: 1.
    You get
    One INSERT targets people. MySQL writes Ada through UTF-8 hex text CONVERT(X'416461' USING utf8mb4), and age is the numeric value 36.

    Options

    Column types
    Unlisted headings remain text. Map only the intended columns to number or boolean; text preserves identifiers and leading zeroes. Empty-to-NULL is a separate choice.
    SQL dialect and upsert
    The selected dialect controls quoting and syntax. PostgreSQL/SQLite conflict keys need a matching existing unique key. MySQL/MariaDB can react to any primary or unique key, not only the entered conflict-key list.
    Batch size
    Group 1–500 records per statement. A final group can be smaller; this does not check a target server statement-size or packet limit.

    Supported inputs and limits

    Generated SQL is source for review; no database is contacted or changed. Values stay text unless an explicit type says otherwise. Upserts need a real matching unique or primary key in the destination. File and row limits apply. Source up to 20 MiB, 100,000 rows, 500 columns and 2,000,000 cells; SQL output up to 10 MiB. XLSX reads stored values only. Batch size is 1 to 500 rows; selected types do not prove a value fits the destination type. MariaDB supports the VALUES() upsert function; newer MySQL deprecates it.

    Where your input is processed

    This tool processes your input in this browser. Your text and files are not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

    Generated SQL still needs a target-schema review

    The tool formats entered table values; it does not connect to a database, create the target table or verify its constraints. Check column types, identifiers, null handling and the intended conflict behavior before execution. Try the script on a disposable copy when replacing real records.

    A type declaration changes how a value is written

    A numeric mapping emits numeric values, while text mappings quote strings. Applying a number type to an identifier can remove a meaningful text convention or reject the value. Keep a source export and review a few statements containing blanks, quotes and formula-like text.

    Questions about Table to SQL Insert Generator

    Does this import into my database?

    No. It creates SQL text. Review it and use your own database tools when ready.

    Will numbers be guessed from the CSV?

    No. Select column types explicitly so account codes and leading zeroes remain text.

    Why must I choose conflict columns?

    PostgreSQL and SQLite upserts need a conflict target. The tool cannot discover or create your destination constraints.

    Project manager: Tony Hines · Content updated 4 October 2026 · Report a problem