CSV to SQL
Generate SQL CREATE TABLE and batched INSERT statements from CSV, TSV or PSV data for standard, PostgreSQL, MySQL or SQLite — locally in your browser.
- Runs locally in your browser
- No upload required
Capabilities
- Drag and drop
- Local file intake
- Download result
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
Generated 2 SQL statement(s) for 2 row(s) across 2 column(s).
How it works
- Parsed the delimited text per RFC 4180 and sanitised the table/column identifiers.
- Inferred each column's SQL type conservatively for the optional CREATE TABLE.
- Quoted identifiers and escaped strings per the chosen dialect, then batched the INSERTs.
- A cell equal to the configured NULL token becomes an unquoted NULL; every other value is quoted as a string.
Methodology
- Parse per RFC 4180 and sanitise the table and column identifiers to conservative tokens.
- Infer each column's SQL type (integer/number/boolean/date/text) for the optional CREATE TABLE.
- Quote identifiers and escape string literals per dialect (doubled quotes for standard/PostgreSQL/SQLite, backslash escaping and backtick identifiers for MySQL), then batch INSERTs.
Usage
- Paste delimited text or choose a local file.
- Choose the SQL dialect, table name, batch size and NULL token.
- Optionally include a CREATE TABLE, then copy or download the statements.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
Generate PostgreSQL INSERTs
{
"text": "id,name\n1,Ada\n2,Alan",
"delimiterMode": "comma",
"delimiter": ",",
"firstRowHeader": true,
"dialect": "postgresql",
"tableName": "people",
"batchSize": 2,
"nullToken": "NULL",
"createTable": true,
"quoteIdentifiers": true
}Limitations
Safety first
INSERT statements modify data. Inspect the generated SQL, check the table and column names and take a backup before running anything against a real database.
Dialect-aware quoting
Identifiers and string literals are quoted per the selected dialect so a column named with a space, or a value containing an apostrophe, does not break the statement.
Frequently asked questions
- Will this run my SQL?
- No. It only generates statements in your browser; you review and run them yourself.
- How are quotes escaped?
- Standard/PostgreSQL/SQLite double single quotes; MySQL uses backslash escaping. Identifiers use double quotes except MySQL, which uses backticks.
Sources
- RFC 4180 — Common Format and MIME Type for Comma-Separated Values (CSV) Files — IETF
- PostgreSQL Documentation — SQL Syntax: Lexical Structure — PostgreSQL Global Development Group
- MySQL 8.0 Reference Manual — String Literals — Oracle
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.