- Workbench 8.0: run the query, then click Export on the result grid toolbar and choose CSV, Excel, JSON, HTML, XML, SQL INSERT or tab-separated.
- The Excel option is listed in the manual as Excel XML, a spreadsheet format Excel can open; CSV is the safer choice for other programs.
- Exports use Unix-style LF line endings by default, according to the manual.
- Workbench 26.7 lists result editing but Oracle does not document a result export yet. SELECT ... INTO OUTFILE (server side) and MySQL Shell util.exportTable() work with any client.
MySQL Workbench export to Excel or CSV from the result grid
The MySQL Workbench Manual documents export directly from a query result. The result grid toolbar has an Export button that writes the result set to a CSV, HTML, JSON, SQL INSERT, Excel, XML or tab-separated file. The steps are:
- Open a connection and run your query in the SQL editor (the manual lists
Ctrl+Enter, orCmd+Returnon macOS, for Execute statement). - In the result grid toolbar, click Export.
- In the Export Resultset window, choose the format, for example CSV or Excel, and a file name.
- Save the file and open it in Excel or another program.
The export covers the result set only. If the query used a LIMIT, the file has only those rows, so remove the limit or raise it before exporting a full result. To copy a few rows instead, right-click a row and use Copy Row or Copy Row (tab separated), which pastes cleanly into a spreadsheet.
| Where | Exports | Formats |
|---|---|---|
| Result grid, Export button | The current query result | CSV, HTML, JSON, SQL INSERT, Excel (listed as Excel XML), XML, tab-separated (TXT) |
| Table Data Export Wizard | One table | CSV, JSON |
| Data Export (Management) | Databases and tables | SQL dump, using mysqldump |
Excel and CSV details to check
- Excel format. The manual's overview table names the format Excel XML. It is not described as a native
.xlsxworkbook, so if you need.xlsx, export CSV and save it from Excel. - Line endings. By default Workbench exports with Unix-style line endings (LF) rather than Windows-style CR/LF.
- Encoding and separators. The Table Data Export Wizard has options for separators and encoding; set them to match the program that will read the file.
- Large results. For millions of rows, a server-side export is usually better than holding the whole result in the GUI.
Export a whole table or database
For a complete table, the manual points to the Table Data Export Wizard: right-click the table in the schema browser, choose Table Data Export Wizard, pick the columns, then choose CSV or JSON and the separator and encoding options. For whole databases with structure, use Data Export in the Management section, which produces SQL files with mysqldump.
Export to CSV with SELECT ... INTO OUTFILE
If your Workbench version has no export option, MySQL itself can write a CSV file. The MySQL 8.4 Reference Manual explains that SELECT ... INTO OUTFILE writes the selected rows to a file created on the server host, so you need the FILE privilege, the file must not already exist and, when secure_file_priv is set to a directory, the file must be written there. The example below follows the manual's CSV example.
SELECT customer_id, full_name, email
INTO OUTFILE '/path/allowed/by/secure_file_priv/customers.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM customers;Export a table with MySQL Shell
MySQL Shell, which Workbench 26 is built on, has a table export utility, util.exportTable(). It writes a table to a local file (or to Oracle Cloud Object Storage), with dialects default, csv, csv-unix and tsv, and a where option to filter rows. The target directory must exist before the export. The result can be loaded elsewhere with util.importTable().
util.exportTable("mydb.customers", "file:///home/user/exports/customers.csv", {dialect: "csv"})Frequently asked questions
How do I export MySQL Workbench query results to Excel?
In Workbench 8.0, run the query, click Export on the result grid toolbar and choose the Excel format (Excel XML) or CSV. Open the file in Excel and save it as .xlsx if you need that format.
Why does my MySQL Workbench export only contain 1000 rows?
The export writes the result set you have. If the query or the editor applied a row limit, only those rows are in the file; run the query without the limit first, or export the table with the Table Data Export Wizard or SELECT ... INTO OUTFILE.
Can I export query results in Workbench 26.7?
Oracle's Workbench 26.7 pages mention result viewing and editing but do not document an export function. Check the result toolbar in your build; otherwise use SELECT ... INTO OUTFILE or MySQL Shell's util.exportTable().
Where does SELECT ... INTO OUTFILE save the file?
On the database server host, not on your computer. If secure_file_priv names a directory, the file must be in that directory.
Can I export a query result as INSERT statements?
Yes, in 8.0 the result grid export offers SQL INSERT as a format, which is useful for moving a few rows to another database.
Sources
- MySQL Workbench product page (Oracle)
- Introducing MySQL Workbench 26 (Oracle MySQL blog)
- MySQL Workbench Manual: Result Grid
- MySQL Workbench Manual: Data Export and Import
- MySQL Workbench Manual: Result Data Export and Import
- MySQL Workbench Manual: Table Data Export and Import Wizard
- MySQL Workbench Manual: Keyboard Shortcuts
- MySQL 8.4 Reference Manual: SELECT ... INTO
- MySQL Shell manual: Table Export Utility
Checked 8 October 2026.
How we research tool guides: our editorial method. CodeWithSQL earns nothing from the vendors mentioned.