CSV to SQL Converter – Generate MySQL INSERT Statements

Turn CSV files into editable MySQL INSERT statements locally, with column previews and explicit NULL or numeric conversion options.

Runs locally
Ready to generate

MySQL INSERT statements only. No database connection or query execution. By default all CSV values stay as strings; enable type changes deliberately. Review SQL before executing it.

Quoted commas and multiline cells supported, up to 500,000 characters.

89 chars

Review before running; default MySQL backslash escape mode assumed.

0 chars

Edit column names

2 data rows; first 3 shown. Column edits apply only to generated SQL, never to the source CSV.

idnamenotesactive
00123O'Reilly, Adafirst line second linetrue
00234Zoëfalse

CSV to SQL guide

How to generate MySQL INSERT statements from CSV

Paste CSV or import a local .csv, .tsv or text file to create MySQL INSERT statements without uploading any records. Preview and edit column names, select a delimiter and review each query before executing it in your database client. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • MySQL INSERT generation
  • CSV and TSV parsing
  • Editable column names
  • Safe MySQL identifier quoting
  • Batch INSERT statements
  • Opt-in numeric inference
  • Opt-in NULL conversion
  • Browser-local file import
  • SQL copy and download

How to use

  1. Paste CSV or import a local CSV, TSV or text file (up to 500,000 characters).
  2. Choose the delimiter and whether the first row contains headers, then review and edit inferred column names.
  3. Enter a MySQL table name and select how many rows to include in each INSERT statement (1 to 1,000).
  4. Optionally enable safe number inference or empty-cell-to-NULL conversion; both are off by default.
  5. Generate INSERT statements, inspect the preview and then copy or download the .sql file.

Preserve identifiers and blank cells until you choose otherwise

A CSV cell does not declare a SQL type. Values such as 00123 may be IDs or codes, so this converter treats every field as a string by default. A blank CSV cell generates an empty SQL string ('') instead of NULL unless you opt in.

Optional numeric inference only emits conservative, finite decimal and integer literals, leaving leading-zero codes and high-precision text quoted. Check the destination table schema rather than relying on examples to decide types.

Escaping and MySQL compatibility

Column and table identifiers are backtick-quoted, including embedded backticks. String values escape apostrophes, backslashes and control characters using MySQL's normal backslash escape rules.

Generated statements target MySQL's default escaping behavior and are not guaranteed to preserve semantics in NO_BACKSLASH_ESCAPES SQL mode, PostgreSQL or SQLite. Always review and test the SQL against a backup before applying it.

  • Multi-line quoted CSV cells remain one field and are escaped as string text.
  • Inconsistent row widths and duplicate column names are rejected rather than silently modified.
  • The browser only generates SQL text; VetaTool never connects to a database or runs queries.

Export safely in manageable batches

Configure 1 to 1,000 rows per INSERT statement. This browser tool limits source input to 500,000 characters, 5,000 records, 64 columns and generated SQL to 2,000,000 characters so conversion remains responsive.

Run generated SQL only with the appropriate database permissions. INSERT statements can fail due to column types, constraints or duplicate keys, and successful SQL generation does not imply a valid import for every schema.

Generate a small MySQL import while retaining leading zeros

A two-column CSV creates one INSERT statement with identifiers safely quoted as text.

CSV

code,name
00123,Ada
00234,Zoë

MySQL SQL

INSERT INTO `imported_csv` (`code`, `name`) VALUES
  ('00123', 'Ada'),
  ('00234', 'Zoë');

Common questions

Frequently asked questions

Does this tool connect to my database?

No. It only converts CSV text into SQL inside your browser. It does not upload your rows or execute SQL.

Is this PostgreSQL or MySQL SQL?

The first version targets MySQL INSERT syntax and normal MySQL string escapes. It does not provide other database dialects.

Does an empty CSV cell become NULL?

Not by default. Blank cells become SQL empty strings. You can explicitly enable NULL conversion.

Will CSV numbers with leading zeros stay unchanged?

Yes by default. Even when safe numeric inference is enabled, codes such as 00123 remain quoted strings.

Can I use quoted commas and line breaks?

Yes. The converter reuses VetaTool's CSV parser to handle properly quoted cells and validate row widths.

Debugging a specific CSV issue? Browse CSV troubleshooting.