How to use the SQL to JSON, CSV & Excel
- Paste
INSERTstatements or open a.sqldump file (mysqldump, pg_dump--inserts, SQLite.dump, phpMyAdmin export). - Pick the output: JSON, CSV or Excel. With several tables, choose one from the table menu.
- Column names come from the INSERT column list or the matching
CREATE TABLEstatement. - Copy the result or download it — the Excel download contains one sheet per table.
What is SQL to JSON / CSV conversion?
Database exports are often SQL scripts: a CREATE TABLE followed by thousands of INSERT INTO … VALUES (…) rows. That is great for restoring a database but awkward when you just want to look at the data, hand it to a colleague in Excel or load it into a script. This tool parses the INSERT statements and gives you the rows as JSON objects, a CSV file or an .xlsx workbook — without installing or restoring a database.
What it understands
- Multi-row inserts:
VALUES (…), (…), (…)as written by mysqldump and most export tools. - Column names from the INSERT column list, or — when the INSERT has none — from the matching
CREATE TABLEin the same script. - Quoted identifiers:
`backticks`,"double quotes"and[brackets], plus schema-qualified names likepublic.users. - String escapes: doubled quotes (
'O''Brien') everywhere, and MySQL backslash escapes ('O\'Brien',\n) — detected automatically or set manually. - Literals: numbers,
NULL,TRUE/FALSE,N'…'Unicode strings,X'…'hex and MySQL charset introducers such as_utf8mb4'…'. - Comments (
--,#,/* … */) and other statements (SET,LOCK TABLES,ALTER) are skipped.
Expressions such as NOW() or CAST(…) cannot be evaluated without a database, so they are kept as text and counted in a notice.
Choosing an output format
| Format | Best for |
|---|---|
| JSON | APIs, fixtures, JavaScript and Python scripts. With several tables, “All tables” returns an object keyed by table name. |
| CSV | Importing into another database, data tools or Google Sheets. The download includes a UTF-8 BOM so Excel shows accents correctly. |
| Excel | Sharing with non-developers: one worksheet per table, bold frozen header, numbers stored as numbers. |
Limits
INSERT … SELECT statements have no literal values and are skipped, as are Oracle INSERT ALL blocks. PostgreSQL COPY … FROM stdin sections are not INSERTs — export with pg_dump --inserts or --column-inserts instead. Going the other way? Use CSV & Excel to SQL or JSON to SQL.
Tools that pair well with the SQL to JSON, CSV & Excel
- JSON to Excel — Turn a JSON array into a real Excel workbook.
- JSON to CSV — Turn a JSON array into a spreadsheet-ready CSV.
- Excel to JSON — Open an .xlsx workbook or paste cells straight from Excel or Google Sheets and get clean JSON.
- CSV & Excel to HTML Table — Paste spreadsheet cells, CSV or JSON and get semantic, escaped HTML table markup — with an optional ready-made style and a live preview.
Frequently asked questions
How do I convert a .sql file to Excel?
Why are my columns named column1, column2…?
Does it work with PostgreSQL dumps?
pg_dump --inserts or --column-inserts. The default COPY format is not made of INSERT statements.