SQL to CSV Converter
Paste INSERT INTO statements or open a .sql dump to get the rows as CSV. Pick the table, choose comma, semicolon or tab, and download the .csv file.
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 reads mysqldump's multi-row INSERTs, PostgreSQL pg_dump's COPY … FROM stdin blocks and SQLite .dump output (including unistr() line breaks). When the INSERTs have no column list, the header comes from the dump's CREATE TABLE. Backtick, double-quote and bracket-quoted names, escaped quotes ('' and \'), NULL values (written as empty cells) and SQL comments are all handled. Values containing commas, quotes or line breaks are quoted correctly in the CSV. For a walkthrough of every dump format, see how to convert a SQL dump to 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
- How do I convert a mysqldump file to CSV?
- Click Open file and choose the .sql file that mysqldump produced (or paste its INSERT statements). The tool lists every table it finds; pick one and download it as CSV. Nothing is uploaded, so large or private dumps are fine up to 25 MB.
- 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?
- A Table menu appears listing every table and its row count. Pick one to get its CSV, then pick the next — each downloads as <table>.csv.
- Can I open a .sql file instead of pasting?
- Yes. Click Open file or drop the .sql file onto the input box (up to 25 MB). It is read by your browser and never uploaded. Use Download to save the result as a .csv file.
- Excel puts everything in one column. How do I fix it?
- In countries where Excel uses a comma as the decimal separator, it expects semicolons between columns. Choose “Semicolon” in the Delimiter menu and download again.
- Is my SQL uploaded anywhere?
- No. The conversion runs entirely in your browser, so your data never leaves your computer.