SQL INSERT to CSV

Turn SQL INSERT statements back into a spreadsheet. Paste a dump or drop .sql files and get a CSV with the column names as the header — multi-row VALUES, escaped quotes, NULLs and comments included. Works with MySQL, PostgreSQL, SQLite and SQL Server syntax.

Handled syntax

SQLCSV cell
'O''Brien'O'Brien
'it\'s'it's
NULL(empty)
NOW()NOW()

When to use it

  1. Open data from a SQL dump in Excel.
  2. Move seed data between databases via CSV.
  3. Review the rows in a migration script.
  4. Extract test data from a SQL file.

How to Use

  1. Paste SQL or drop .sql files.
  2. Choose the delimiter and NULL text.
  3. Copy or download the CSV.

Features

  1. Proper tokenizer
  2. Multi-row VALUES
  3. Quote and escape handling
  4. NULL handling
  5. Comments skipped
  6. Batch to ZIP

FAQs

Can it handle commas inside strings?

Yes. A real tokenizer reads the values, not a regex.

What happens to NULL?

It becomes an empty cell, or any text you choose.

Does it support multi-row INSERTs?

Yes, any number of tuples per statement.

What about CREATE TABLE and other statements?

They're skipped.

Is my SQL uploaded?

No.

Technical Details

Statements are read by a small state-machine tokenizer rather than regular expressions, so commas, semicolons, parentheses and quotes inside string values never break a row. It recognizes INSERT [IGNORE] INTO with an optional column list, and both VALUES and VALUE with any number of row tuples. Identifiers can be quoted with backticks, double quotes or brackets. Strings handle doubled single quotes, backslash escapes, and the N'…' and E'…' prefixes. NULL becomes an empty cell or a text of your choice. Numbers and function calls such as NOW() are kept as written. Comments (--, # and /* */) and non-INSERT statements are skipped. The header comes from the first column list, or column_1… when there is none.

Data & CSV Tools

Data & CSV Tools

  • JSON Normalizer
  • CSV \u21c4 YAML
  • XSD Viewer
  • CSV Column Extractor
  • CSV Delimiter Converter
  • CSV to SQL INSERT
  • CSV to Markdown Table
  • CSV to JSON