Skip to main content

Table to SQL INSERT

Generate SQL INSERT statements from Excel, CSV, or JSON. Processed locally in your browser without uploading the file.

  • Clipboard
  • Export

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Generate SQL INSERT statements from a table with escaped strings, NULL values, and protected identifiers.

Your files are processed locally in your browser and are never sent to our servers.

Drop your file here

Recommended size: up to 30 MB

Options

Was this tool useful?

On this page

How does this tool work?

Converting a table into SQL INSERT statements helps prepare small datasets, demonstrations or imports that need review before execution. Each source record becomes one statement with an explicit column list. This tool generates SQL text in your browser; it neither connects to a database nor executes queries. Its quoting conventions must match your SQL engine and the schema already present in the receiving database. Treat the output as a reviewable script rather than a completed database import.

Import CSV, TSV, XLSX, XLS or flat tabular JSON through the drop zone, limited to 30 MiB per file. Workbook imports use the first sheet here without preserving styles or macros. Choose the destination table name. Import may suggest a simplified name based on the filename, so check it before generation. The entered name is treated as one identifier: schema.customers means a name containing a dot, not automatic schema and table qualification.

Columns follow their first appearance order and are quoted with double quotation marks, like the table name. Embedded identifier quotes are doubled. Each record creates an INSERT INTO statement with explicit columns and VALUES. Strings use single quotes, with internal apostrophes doubled. Finite JavaScript numbers are unquoted; booleans become TRUE or FALSE; null and missing properties become NULL. An empty string remains an empty string, distinct from a database null.

Imported types determine the literal: CSV text 42 becomes '42', while a JSON number 42 becomes 42. The tool does not infer the destination schema, automatically convert dates or generate CREATE TABLE. It provides no conflict handling, UPSERT, transaction wrapper or optimized batch loading. Copy or download .sql and inspect it in a test environment. Dialect, encoding and string-literal rules require real compatibility checks before execution, especially when backslashes or unusual identifiers are present.

How to use this tool

  1. Check the target schema

    Confirm table name, columns, types, constraints and dialect. The converter does not know your database’s generated values or validation rules.

  2. Inspect literal types

    Generate the text and check an apostrophe, unusual identifier, empty cell and numeric value against the imported types.

  3. Test before real execution

    Try a small subset in a test database with normal safeguards. For large volumes, prefer the database’s native import facility to thousands of independent statements.

Use cases

Prepare test data

Turn a small checked reference table into readable INSERT statements for development.

Document a SQL example

Create reproducible records for explaining a query after removing personal or internal data.

Review a one-off import

Inspect column names and literals before adapting a load for an existing database table.

Examples

CSV values remain strings

Target table: customers. The apostrophe is doubled and the CSV quantity remains quoted text.

Input

name;quantity
O'Brien;42

Result

INSERT INTO "customers" ("name", "quantity") VALUES ('O''Brien', '42');

JSON types and missing values

Target table: accounts. Numbers and booleans use their literals; null becomes NULL and an empty string remains ''.

Input

[{"id":1,"active":true,"note":null},{"id":2,"active":false,"note":""}]

Result

INSERT INTO "accounts" ("id", "active", "note") VALUES (1, TRUE, NULL);
INSERT INTO "accounts" ("id", "active", "note") VALUES (2, FALSE, '');

Tips and best practices

  • Compare output columns with the actual schema, particularly generated identifiers. A syntactically valid list can still violate constraints or supply values of unsuitable types.
  • Do not treat doubled apostrophes as universal dialect compatibility. Identifier quotes, boolean literals and backslash handling vary across database engines and configurations, so test the actual destination.
  • Keep sensitive records out of shared examples. Processing is local, but the resulting SQL contains plain values that can later be copied into a ticket, repository or message.

Sources and references

Frequently asked questions

Is the table created automatically?

No. Output contains INSERT statements only and assumes an existing table with compatible columns. Types, indexes, keys and constraints are not defined. Prepare the schema separately and check which columns should be omitted, including database-generated or computed fields.

Why are CSV numbers quoted?

CSV cells are imported as strings. The tool respects that type instead of guessing whether a reference, postal code or quantity should be numeric. The database may apply conversions, but verify them rather than relying on implicit behavior.

Does this SQL work unchanged in every database?

No. It quotes identifiers with double quotes, strings with apostrophes and booleans with TRUE/FALSE. Those conventions do not cover every dialect or configuration. Check qualified names and the receiving engine’s escaping rules before running the script.

Can the tool send records to my database?

No. It produces a local text file without database connections, credentials or query execution. Actual loading is a separate step with separate consequences. Use a test environment and the procedures appropriate to your database before executing elsewhere.

Related tools

Tools similar or complementary to this one.

Works well with

Convert Excel, CSV, or JSON into a copy-ready Markdown table.

Data & spreadsheetsUse this tool

Turn Excel, CSV, or JSON into semantic HTML table markup.

Data & spreadsheetsUse this tool

Convert Excel, CSV, and other spreadsheet formats directly in your browser.

Data & spreadsheetsFeaturedUse this tool
GuideBest practicesBeginner

Split a CSV or Excel table into smaller files

Discover when to split a large table by row count or by a column value, and how to preserve a useful structure in every output file.

29 August 20262 min