Convert SQL to CSV
Extract database
data instantly.
Free SQL to CSV converter. Upload a .sql file to extract data from INSERT statements, or paste query output directly from MySQL, PostgreSQL, SQLite or SQL Server. Runs entirely in your browser.
Two input modes for two common workflows.
SQL INSERT file — for .sql dump files from mysqldump, pg_dump or SQLite. CSVShift parses every INSERT INTO … VALUES block and extracts column names and row data. Handles single-row and multi-row batch inserts, quoted strings and NULL values. SQL Query Output — paste the text output from any SQL client terminal directly.
In INSERT mode, drop your .sql file and CSVShift counts the INSERT statements before you convert. In Query Output mode, copy the result from your SQL client (MySQL Workbench, psql, DBeaver, DataGrip) and paste it into the text area. Tab, pipe and space-aligned formats are all detected automatically.
Preview the first 10 rows to verify the column structure, then download the .csv file or copy it to your clipboard. The output is RFC 4180 compliant — compatible with Excel, Google Sheets and any database import tool.
Native commands for each database — before or instead of using this tool.
Common situations where extracting SQL data into CSV is necessary.
SQL dump files from mysqldump or pg_dump contain INSERT statements. Converting them to CSV lets you analyse the data in Excel or Google Sheets, or re-import it into a different database system, without needing a running database instance.
When migrating from one database system to another — MySQL to PostgreSQL, SQLite to MySQL — exporting the source data as CSV and re-importing is often simpler than converting the SQL dump directly, which requires adapting syntax differences between dialects.
When a database query result needs to be shared with a non-technical colleague, copying the output from a SQL client and converting to CSV produces a clean spreadsheet without requiring database access on the recipient's side.
Compliance teams often need transaction or event data extracted from databases as immutable CSV records. Converting SQL query results to CSV produces a portable, auditable snapshot that can be archived or sent to external auditors.
Other free converters on CSVShift you might need.
SQL data parsed
in your browser. No upload.
CSVShift processes SQL files and query output entirely in your browser. Your .sql dump file — which may contain sensitive production data — is never uploaded to any server. Both the INSERT parser and the query output parser run in JavaScript locally on your device.
The INSERT parser handles single-quote escaping, NULL values, multi-row batch inserts, backtick and double-quote identifiers, and the various whitespace styles produced by different database tools.
SELECT * FROM table INTO OUTFILE '/tmp/out.csv' FIELDS TERMINATED BY ',' — fastest but requires server file access. 2) Copy grid results from MySQL Workbench and paste in Query Output mode here. 3) Use mysqldump to get a .sql file, then upload it in INSERT File mode.\copy (SELECT * FROM table) TO 'file.csv' CSV HEADER; from the psql CLI. Alternatively, copy the result grid from pgAdmin or DBeaver and paste it into CSVShift's Query Output mode — tab-separated format is detected automatically.