SQL to CSV Converter
Paste INSERT INTO statements to get their rows as CSV. The column list becomes the header row.
Advertisement
Get the data out of a SQL dump
Sometimes all you have is a .sql file — a mysqldump export, a seed script or a backup — and you need the data in Excel or Google Sheets. Restoring it into a database just to export it again is slow. This tool reads the INSERT INTO ... VALUES statements directly and turns every row into a CSV line.
It handles multi-row INSERTs, backtick, double-quote and bracket-quoted names, escaped quotes ('' and \'), NULL values (written as empty cells) and SQL comments. Values containing commas, quotes or line breaks are quoted correctly in the CSV.
Example
SQL input:
INSERT INTO `customers` (`id`, `name`, `city`) VALUES
(1, 'Sara Khan', 'Lahore'),
(2, 'Ali O''Brien', 'Karachi, Sindh');CSV output:
id,name,city
1,Sara Khan,Lahore
2,Ali O'Brien,"Karachi, Sindh"Frequently asked questions
- Can it convert SELECT query results?
- No — a SELECT statement has no data in it, only the database has the results. Run the query in your database client and use its export, or paste the INSERT statements from a dump here.
- What if my INSERTs have no column list?
- The header row is then named column_1, column_2 and so on. You can rename the headers after opening the CSV.
- My dump inserts into several tables. What happens?
- The first table's rows are converted and a note lists the other tables. Paste each table's INSERT statements separately to get one CSV per table.
- Is my SQL uploaded anywhere?
- No. The conversion runs entirely in your browser, so your data never leaves your computer.