How to Convert SQL to CSV: Complete Guide
Last updated: 2026-04-15
You have a SQL dump file full of INSERT INTO statements and you need the data in a spreadsheet. Or you are migrating away from one database and the export tool only gives you SQL. Whatever the scenario, extracting tabular data from SQL into CSV saves you from spinning up a database just to run a query.
Step-by-Step: Convert SQL to CSV with Convertee
- Open Convertee and select SQL as the source format and CSV as the target.
- Paste your SQL
INSERTstatements into the input panel, or drop a.sqlfile. - Choose your delimiter (comma, tab, semicolon) and whether to include a header row.
- Click Convert (Cmd+Enter).
- Copy the CSV or download the file.
Convertee parses SQL entirely in the browser. No data leaves your machine, and no database engine is needed.
What SQL Input Is Supported?
Convertee extracts data from standard INSERT INTO statements. It supports single-row and multi-row inserts, quoted strings, numeric literals, NULL, and common escape sequences. The parser handles MySQL, PostgreSQL, and SQLite dialects.
INSERT INTO users (name, age, city) VALUES
('Alice', 30, 'Seoul'),
('Bob', 25, 'Tokyo'),
('Charlie', 35, 'Berlin');Output CSV:
name,age,city
Alice,30,Seoul
Bob,25,Tokyo
Charlie,35,BerlinUnderstanding the Formats
SQL INSERT Statements
SQL (Structured Query Language) is standardized by ISO/IEC 9075. The INSERT INTO statement adds rows to a table. Column names in parentheses define the header, and VALUES clauses supply the data.
CSV
CSV (RFC 4180) is the simplest tabular format. One row per line, fields separated by a delimiter, quotes around values that contain the delimiter or newlines.
Common Use Cases
- Database migration. Export data from one DB as SQL, convert to CSV, and import into another system that accepts CSV.
- Data inspection. Open a SQL dump in a spreadsheet to spot-check values before running the statements against a live database.
- Sharing with non-technical teams. SQL dumps are opaque to most business users. CSV opens directly in Excel or Google Sheets.
- Backup verification. Convert backup SQL files to CSV to quickly audit row counts and data integrity without restoring the full database.
Handling Edge Cases
- NULL values. SQL
NULLis written as an empty cell in CSV. This is consistent with how spreadsheets treat missing data. - Escaped quotes. Single quotes inside SQL strings (e.g.,
O''Brien) are unescaped to produceO'Brienin the CSV output. - CREATE TABLE statements. If your SQL dump includes
CREATE TABLEorDROP TABLE, Convertee skips those lines and only parsesINSERTstatements.
Frequently Asked Questions
- What SQL statements does Convertee parse?
- Convertee parses standard INSERT INTO statements, including single-row and multi-row inserts. CREATE TABLE, DROP TABLE, and other DDL statements are ignored. It supports MySQL, PostgreSQL, and SQLite dialects.
- How are NULL values represented in the CSV output?
- SQL NULL values are converted to empty cells in CSV. This is consistent with how spreadsheets and most CSV parsers handle missing data.
- Can I convert a full database dump file?
- Yes, as long as the file is under 1 MB (free tier limit). Convertee will skip non-INSERT statements and extract data from all INSERT statements it finds.