Skip to content
Guide · MySQL Workbench

How to Export Query Results to Excel/CSV in MySQL Workbench

In MySQL Workbench 8.0 the result grid has an Export button that saves a query result as CSV, Excel, JSON, HTML, XML, SQL INSERT statements or a tab-separated file. Whole tables go through the Table Data Export Wizard. Oracle has not yet documented export in Workbench 26.7, so this guide also covers SELECT ... INTO OUTFILE and MySQL Shell's table export utility.

Steps and facts checked 8 October 2026 against the vendor's official documentation. Versions covered: MySQL Workbench 8.0.47 (documented export, end of life); MySQL Workbench 26.7.0; MySQL 8.4 LTS; MySQL Shell 26.7. Next review due April 2027. Menus, shortcuts and prices change between releases; check the vendor's documentation for your version.
Short answer
  • 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.
How we know: Research-based: export features were checked against the MySQL Workbench Manual (8.0 through 8.0.47), the scope of Workbench 26.7 against Oracle's product page and MySQL blog, and the SQL and MySQL Shell options against the MySQL 8.4 Reference Manual and the MySQL Shell manual on 8 October 2026. We have not run these exports for this guide, and Oracle's pages show no screen layout for 26.7.

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:

  1. Open a connection and run your query in the SQL editor (the manual lists Ctrl+Enter, or Cmd+Return on macOS, for Execute statement).
  2. In the result grid toolbar, click Export.
  3. In the Export Resultset window, choose the format, for example CSV or Excel, and a file name.
  4. 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.

Export formats documented for MySQL Workbench 8.0
WhereExportsFormats
Result grid, Export buttonThe current query resultCSV, HTML, JSON, SQL INSERT, Excel (listed as Excel XML), XML, tab-separated (TXT)
Table Data Export WizardOne tableCSV, JSON
Data Export (Management)Databases and tablesSQL 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 .xlsx workbook, 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.

Write a query result to a CSV file on the server (MySQL 8.4)
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().

Export a table to CSV in MySQL Shell (JavaScript mode)
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

Checked 8 October 2026.

How we research tool guides: our editorial method. CodeWithSQL earns nothing from the vendors mentioned.

Still choosing a SQL client?

Read the full reviews, or compare tools side by side.