SQL to CSV Converter
Sometimes the only copy of the data you need is a .sql file from a backup, a dump of INSERT INTO users (id, email, created_at) VALUES (...) statements. Loading it into a database just to export it again is slow. This converter reads the column list and each VALUES tuple straight from the INSERT syntax and emits a CSV you can open in Excel, Google Sheets, Numbers or pandas without ever restoring the schema.
How to convert SQL INSERTs to CSV
-
1
Paste the SQL
Drop in one or more INSERT statements. Both single-row and multi-row VALUES (...) blocks are supported.
-
2
Columns auto-detected
The parser reads the `(col1, col2, ...)` list right before VALUES and treats it as the CSV header row.
-
3
Rows extracted
Each `(val1, val2, ...)` tuple becomes a CSV row. Single-quoted strings are unquoted; numbers and NULLs pass through as text.
-
4
Copy the CSV
Grab the CSV output and paste it into a spreadsheet, or save it with a `.csv` extension.
What the parser accepts
INSERT INTO users (id, email, created_at) VALUES
(1, 'alice@example.com', '2024-01-12 09:00:00'),
(2, 'bob@example.com', '2024-01-13 10:30:00'),
(3, 'carol@example.com', '2024-01-13 11:15:00');
Becomes:
id,email,created_at
1,alice@example.com,2024-01-12 09:00:00
2,bob@example.com,2024-01-13 10:30:00
3,carol@example.com,2024-01-13 11:15:00
CSV escaping rules applied
- The delimiter is always a comma; there is no separator option.
- Fields containing commas, double quotes or newlines are wrapped in double quotes.
- Internal double quotes are doubled (
"becomes""), per RFC 4180. - Leading and trailing single quotes from SQL string literals are stripped.
- SQL
NULLpasses through as the literal textNULL; replace it downstream if your tooling expects empty cells.
Limitations to know
- Column list required. The parser reads the header from the
(col1, col2, ...)list before VALUES. A bareINSERT INTO t VALUES (...)without the column list produces CSV rows with no header. - One table at a time. If your dump mixes INSERTs for different tables, split them first. Rows of different widths produce a ragged CSV.
- No CREATE TABLE parsing. Column types are not used. Dates, JSON and binary blobs come through as raw text.
- Every parenthesis group becomes a row. The parser turns each
(...)group into a row, so trailing clauses that contain parentheses (ON DUPLICATE KEY UPDATE,RETURNING), function calls likeNOW(), or nested arrays like(1,2,3)inside a value add stray rows. Keep the input to plainINSERT ... VALUEStuples and replace such expressions with literals before pasting.
Frequently Asked Questions
Yes, as long as the INSERT follows the standard INSERT INTO table (cols) VALUES (...) form, which is shared across those databases. The tool does not run a full SQL parser: it extracts the column list and the parenthesised value tuples, so keep each statement to plain INSERT syntax.
Commas inside single-quoted SQL strings are preserved. On output, any field containing a comma, quote or newline is wrapped in double quotes and internal quotes are doubled, matching RFC 4180. Values that themselves contain parentheses may not split cleanly.
No. Your SQL is sent to our server, parsed in one pass and returned, so keep the input to a few megabytes at a time. For very large dumps, split the file into chunks (one INSERT block per chunk) and convert them in pieces.
No, the output is a flat CSV. Column types, indexes and constraints live in CREATE TABLE and are outside the scope of this converter.
Your SQL is sent to our server only to produce the CSV and is not stored; we keep an anonymous count of how many rows were converted, never the SQL text itself.
Related Tools
EPUB to PDF Converter
Convert EPUB ebooks into PDF files with fixed pages that are easy to print, annotate and share. Keeps chapters, images and the table of contents. Upload and download.
File Extension Identifier
Find out a file type and its MIME type from a filename or extension, with a reference of common formats and tips for spotting double extensions.
Word to Markdown Converter
Convert a Word DOCX file to clean Markdown in your browser. Keep headings, lists, links and simple tables, then copy or download the editable .md file.
FLAC to MP3 Converter
Convert lossless FLAC audio to smaller, universally compatible MP3 files for phones, car stereos, players and sharing. Keeps your tags. Upload and download.
Excel to CSV Converter
Convert XLSX or XLS sheets to CSV or TSV in your browser. Select sheets, delimiters, encoding and hidden data, with no file upload.
MOV to MP4 Converter
Convert QuickTime MOV videos to MP4 for smooth playback on any device, easy sharing and reliable web uploads. Upload a .mov file and download a compatible .mp4.
Tool available in other languages
- Conversor de SQL para CSV [PT]
- SQLからCSVへの変換ツール [JA]
- Conversor de SQL a CSV [ES]
- SQL을 CSV로 변환하는 도구 [KO]
- Trình chuyển đổi SQL sang CSV [VI]
- SQL till CSV-konverterare [SV]
- محوّل SQL إلى CSV [AR]
- SQL-zu-CSV-Konverter [DE]
- ตัวแปลง SQL เป็น CSV [TH]
- Convertisseur SQL en CSV [FR]
- SQL-naar-CSV-converter [NL]
- Konverter SQL ke CSV [ID]
- Konwerter SQL na CSV [PL]
- Convertitore da SQL a CSV [IT]
- Конвертер SQL в CSV [RU]
- SQL'den CSV'ye Dönüştürücü [TR]
- SQL 转 CSV 转换器 [ZH]