SQL to CSV
Export SQL result sets to CSV or rebuild INSERT statements.
Designed to run in your browser. See the privacy policy.
About SQL to CSV
This SQL to CSV converter turns the result table you get from a database client into a clean CSV file you can open in Excel, Google Sheets or any other spreadsheet. It understands the MySQL-style ASCII tables with +----+ borders that the mysql command line prints, as well as rows separated by pipes or tabs, which covers most copy-and-paste output from SQL consoles.
It also works the other way round. In "Data → INSERT" mode you paste CSV with a header row and get ready-to-run INSERT statements for a table name you choose. The conversion happens in your browser, which is handy when the rows contain customer or internal data you would rather not paste into a random website.
How to use
- Pick a mode at the top: "Result → CSV" to convert a query result, or "Data → INSERT" to build SQL from CSV.
- For Result → CSV, paste the result set into the SQL result set box, including the header row.
- For Data → INSERT, paste CSV whose first row is the column names, then set the Table name.
- Turn on "Multi-row INSERT" if you want a single INSERT with many VALUES groups instead of one statement per row.
- Copy the output, or use the download button to save it as result.csv or inserts.sql.