SQL Insert to CSV
Turn INSERT statements into a CSV with a header row, quoted where a value needs it. Runs in your browser.
What INSERT to CSV does
The column list becomes the header and each VALUES tuple becomes a row. A cell is quoted only when it has to be — a comma, a quote or a line break inside it — so the output is readable as well as correct. NULL becomes an empty cell, which is the one lossy step: CSV has no way to tell null from an empty string, and the round trip back will write NULL again. This is the inverse of CSV to INSERT, and a test asserts that a CSV put through both directions comes back identical.
How to use it
SQL Insert to CSV: paste the SQL into the box above, and press Run to get the CSV below.
Worked example
Input:
INSERT INTO users (id, name, role) VALUES
(1, 'Ada', 'admin'),
(2, 'O''Brien', 'author'),
(3, 'Grace', NULL);
Output:
id,name,role
1,Ada,admin
2,O'Brien,author
3,Grace,
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads SQL and returns CSV; reloading the page discards both.
The column list becomes the header and each VALUES tuple becomes a row. A cell is quoted only when it has to be — a comma, a quote or a line break inside it — so the output is readable as well as correct. NULL becomes an empty cell, which is the one lossy step: CSV has no way to tell null from an empty string, and the round trip back will write NULL again. This is the inverse of CSV to INSERT, and a test asserts that a CSV put through both directions comes back identical.
Turn INSERT statements into a CSV with a header row, quoted where a value needs it. Runs in your browser.
How to use it
SQL Insert to CSV: paste the SQL into the box above, and press Run to get the CSV below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads SQL and returns CSV; reloading the page discards both.
What to Expect
Best for
- Converting SQL to CSV when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
INSERT INTO users (id, name, role) VALUES (1, 'Ada', 'admin'), (2, 'O''Brien', 'author'), (3, 'Grace', NULL);
Sample output
id,name,role 1,Ada,admin 2,O'Brien,author 3,Grace,
Frequently asked questions
How do I use the sql insert to csv?
SQL Insert to CSV: paste the SQL into the box above, and press Run to get the CSV below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.