Quick example: SQL INSERT → CSV
Paste a SQL INSERT statement like this:
INSERT INTO employees (id, name, department) VALUES
(1, 'Alice', 'Engineering'),
(2, 'Bob', 'Marketing');…and get clean CSV output instantly:
id,name,department
1,Alice,Engineering
2,Bob,MarketingHow to use it: paste your SQL above, click Convert, then copy or download the result. The tool handles quoted string fields, strips SQL syntax, and auto-detects numbers so they don't get wrapped in extra quotes. Everything runs entirely in your browser — your data is never uploaded anywhere.
Turn SQL Data into a Spreadsheet-Ready CSV in Seconds
Copy a block of SQL INSERT statements or a CREATE TABLE dump, paste it into the converter above, and you get a clean CSV file (comma-separated values) you can open straight in Excel, Google Sheets, or any data tool. No installs, no sign-up, no waiting.
This is the fastest way to move data out of a database export — whether you got a .sql dump from MySQL, PostgreSQL, or SQLite — and into a format your teammates, clients, or BI tools can actually read.
How to Convert SQL to CSV
- Paste your SQL into the input box above. This works with
INSERT INTOstatements, full table dumps, or just the data rows. - Click Convert. The engine parses the SQL and builds the CSV automatically.
- Copy or Download the result. One click copies to your clipboard; another saves it as a
.csvfile.
That's it. No configuration needed for standard SQL dumps.
Worked Example: MySQL Dump to CSV
Say you export a small table from MySQL and get this in your .sql file:
INSERT INTO orders (order_id, customer, total) VALUES
(101, 'Jane Smith', 49.99),
(102, 'Raj Patel', 129.00),
(103, 'Marie Curie', 19.50);After converting, your CSV looks like this:
order_id,customer,total
101,Jane Smith,49.99
102,Raj Patel,129.00
103,Marie Curie,19.50Notice that the column names come from the SQL field list, the quotes around string values are cleaned up, and numeric fields like total stay unquoted — exactly what Excel and Pandas expect.
How to Do This in Python and JavaScript
If you need to automate the conversion in code, here are the simplest approaches:
Python
Use sqlalchemy or just parse with sqlite3. The quickest one-liner for a dump file uses Pandas:
import sqlite3, pandas as pd
# Load your SQL dump into a temporary SQLite database
conn = sqlite3.connect(':memory:')
with open('dump.sql', 'r') as f:
conn.executescript(f.read())
df = pd.read_sql('SELECT * FROM orders', conn)
df.to_csv('orders.csv', index=False)This loads the SQL dump into an in-memory database, queries it, and writes the CSV. Adjust the table name to match yours.
JavaScript (Node.js)
// Using the 'better-sqlite3' and 'csv-stringify' packages
const Database = require('better-sqlite3');
const { stringify } = require('csv-stringify/sync');
const fs = require('fs');
const db = new Database(':memory:');
const sql = fs.readFileSync('dump.sql', 'utf8');
db.exec(sql);
const rows = db.prepare('SELECT * FROM orders').all();
const csv = stringify(rows, { header: true });
fs.writeFileSync('orders.csv', csv);Run npm install better-sqlite3 csv-stringify first. The same pattern works for any table name.
How It Works Under the Hood
The converter parses your SQL text and looks for INSERT INTO tablename (col1, col2, ...) VALUES (...) patterns. It reads the column list from the first statement and treats that as the CSV header row. Each VALUES tuple becomes one CSV row.
String values have their surrounding SQL single-quotes removed. Numbers are written as-is. Fields that contain a comma get wrapped in double-quotes to keep the CSV valid — this follows the CSV format standard defined in RFC 4180.
Everything runs client-side in your browser using JavaScript. Your SQL data never leaves your machine.
When to Use This Tool (and When Not To)
| Good fit | Not the best fit |
|---|---|
| Exporting rows from a SQL dump to share as a spreadsheet | Very large dumps (millions of rows) — use a CLI tool or database client instead |
| Moving data from a local SQLite or MySQL backup into Excel or Google Sheets | Complex SQL with JOINs, subqueries, or stored procedures — paste the raw result set, not the query |
| Quick one-off data migrations or sharing a snapshot with a non-technical colleague | Tables with binary data or BLOB columns — CSV can't represent binary cleanly |
For other format needs, you can also convert this same table data to JSON, Markdown, Excel, or 15+ other formats using the same tool — just switch the output format selector.
Working With Your CSV Output
Once you have your CSV, you can open it directly in Microsoft Excel (File → Open), Google Sheets (File → Import), or load it into Python with pd.read_csv('orders.csv'). Most BI tools like Tableau, Power BI, and Looker accept CSV as a data source.
If your workflow involves JSON too, check out our JSON Beautifier for formatting JSON data, or the JSON Validator if you need to check JSON from a database API response for errors. You can also convert JSON to YAML if your target system needs that format.
Tips for Clean Results
- Include the column list in your
INSERTstatement (e.g.INSERT INTO t (col1, col2)) — not justINSERT INTO t VALUES. Without it, headers default to generic names likecol1,col2. - One table at a time gives the clearest output. If your dump has multiple tables, paste each
INSERTblock separately. - Check for encoding issues if your data has accented characters (é, ü, ñ). Save or copy as UTF-8 for best compatibility.
- If a field value contains a comma or a newline, the tool automatically wraps it in double-quotes — your CSV stays valid.
Paste your SQL above and download your CSV in seconds — it's the fastest path from a database dump to a spreadsheet anyone can open.