Skip to content
migration.tools
SQL to CSV

SQL to CSV converter

Extract the rows from SQL INSERT statements — a mysqldump or a seed script — into a CSV you can open in a spreadsheet.

Going the other way? CSV to SQL

Options

SQL

CSV

The result appears here as soon as there is input.

Processed on this device. Nothing you paste or drop is uploaded.

How to use it

  1. 1Paste your SQL or drop a file onto the input panel.
  2. 2Adjust the options — the result updates as you type.
  3. 3Copy the CSV or download it. Drop several files to convert a batch into one ZIP.

How SQL becomes CSV

Both formats are tabular, so the conversion is a faithful re-encoding: the same header, the same rows in the same order, with quoting and escaping rewritten for CSV.

SQL and CSV, briefly

SQL INSERT scripts are the most portable way to load rows into a relational database: any client can run them, and they can be reviewed and version-controlled like code.

CSV is the lowest common denominator for tabular data: every spreadsheet, database and import wizard reads it. It has no types and no nesting, and details such as the delimiter, quoting and encoding vary between programs.

Questions

Which SQL statements does it read?

INSERT INTO … VALUES statements, including multi-row inserts and mysqldump output. Column names come from the INSERT's column list, or from a CREATE TABLE statement in the same script when the INSERT doesn't list them.

Will the CSV open correctly in Excel?

Yes. Fields containing commas, quotes or line breaks are quoted the way Excel expects. If accented characters look wrong, turn on the UTF-8 BOM option; for European locales where Excel expects semicolons, change the delimiter.

Guides that use this tool