Table to SQL Insert Generator

Generate SQL inserts or upserts with editable column types, optional detection and a starter table definition.

On-device No sign-up Free to use

Generate SQL 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.

    ?

    Numbers up to 15 digits and true/false columns. Leading-zero identifiers and mixed columns stay text; explicit types take precedence.

    ?

    Both choices preserve text across SQL modes. Other dialects use their own quoted text.

    ?

    Uses TEXT, BOOLEAN/INTEGER and DOUBLE PRECISION. Review numeric precision, constraints and keys before executing; upsert keys are not created.

    ?

    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 an example. Change the fields, then use generate sql to update it.

    Result

    Showing an example.

    Generate two typed INSERT statements without a CREATE TABLE statement.

    Generated 2 insert statements for 2 rows and 3 columns.

    Loading the tool. Your result will appear here.

    https://usefreetools.net/table-to-sql-insert-generator · 20 November 2026

    Was this helpful?

    How to use Table to SQL Insert Generator

    1. Paste a table with headings, or clear the text box and choose a CSV, TSV or XLSX file. For XLSX, select the worksheet if the first visible one is not the intended source.
    2. Choose the destination dialect and table identifier. Map column types explicitly; enable simple type detection only for unmapped columns you want inspected.
    3. Choose Insert or Upsert, the batch size and whether empty cells become SQL NULL. For upsert, review the destination's actual primary/unique keys and the conflict-key headings.
    4. Optionally request a starter CREATE TABLE, then review its approximate numeric types and missing constraints. Download the SQL and test it against a disposable database before using it on real records.

    Example: Table to SQL Insert Generator

    Generate two typed INSERT statements without a CREATE TABLE statement.

    You add
    Source table: id,name,active 1,Alice,true 2,Bob,false; Destination table name: people; SQL dialect: mysql; Column types JSON: {"id":"number","active":"boolean"}; Detect unlisted column types: false; MySQL / MariaDB text literals: quoted; Include a starter CREATE TABLE: false; Statement type: insert; Rows per statement: 1; Upsert conflict-key headings: id; Convert empty cells to SQL NULL: false
    You get
    Generated 2 insert statements for 2 rows and 3 columns.

    Options

    Source table
    A heading row and up to 100,000 data rows. Clear this box to choose a file.
    XLSX worksheet
    Optional worksheet name or 1-based number. Blank uses the first visible worksheet.
    Destination table name
    One table identifier, not a SQL expression or a schema-qualified path.
    Column types JSON
    Map headings to text, number or boolean. Unlisted columns remain text, including leading zeroes.
    Detect unlisted column types
    Numbers up to 15 digits and true/false columns. Leading-zero identifiers and mixed columns stay text; explicit types take precedence.
    MySQL / MariaDB text literals
    Both choices preserve text across SQL modes. Other dialects use their own quoted text.
    Include a starter CREATE TABLE
    Uses TEXT, BOOLEAN/INTEGER and DOUBLE PRECISION. Review numeric precision, constraints and keys before executing; upsert keys are not created.
    Rows per statement
    Group 1 to 500 rows into each INSERT statement. The final group may contain fewer rows.
    Upsert conflict-key headings
    Comma-separated headings. PostgreSQL/SQLite need an existing matching unique key. MySQL/MariaDB reacts to any primary or unique key.

    Supported inputs and limits

    • Source up to 20 MiB, 100,000 rows, 500 columns and 2,000,000 cells;
    • SQL up to 10 MiB.
    • Detect unlisted simple numbers/booleans only when selected; leading-zero IDs and mixed/long numeric text remain text.
    • Readable MySQL/MariaDB text falls back to UTF-8 hex for backslashes/control characters; an all-hex option remains.
    • Starter CREATE TABLE uses TEXT, Boolean/INTEGER and approximate DOUBLE PRECISION, without keys/constraints.
    More details

    Review destination precision and keys.

    Batch size: 1–500.

    No database is contacted.

    Where your input is processed

    This tool does not upload your inputs. See the limits for anything saved 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?

    Only when Detect unlisted column types is enabled. It detects supported simple numbers and true/false values for unmapped columns; explicit mappings take precedence. Leading-zero IDs, long numeric strings and mixed columns stay text. Leave detection off when you need every type chosen explicitly.

    Why must I choose conflict columns?

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

    Page updated · Project managed by Tony Hines · Report a problem with Table to SQL Insert Generator