- Run your query (or open a table's Data tab), then choose Tools > Export grid rows, or right-click the grid.
- For Excel, pick the Excel CSV format: HeidiSQL uses a comma separator, or a semicolon when your system's decimal separator is a comma, and adds a UTF-8 BOM when writing a file.
- There is no native .xlsx export; HeidiSQL writes CSV, which Excel opens directly.
- Row selection is Selected rows or All loaded rows. On the Data tab only the loaded rows are exported, so load all rows first or export from a query.
- Other formats include Delimited text, HTML, XML, several SQL statement styles, LaTeX, Textile, PHP array, Markdown, JSON and JSON Lines.
HeidiSQL export to Excel: step by step
- Run your query in a query tab (F9), or select a table and open its Data tab.
- Choose Tools > Export grid rows. The action's description is "Export rows to file or copy to clipboard, in various formats".
- Under Row selection, choose All loaded rows (or Selected rows if you highlighted some).
- Under Output target, choose File and double-click the box to pick a file name, or choose Copy to clipboard. Set Encoding (UTF-8 is the usual choice).
- Under Output format, choose Excel CSV.
- Under Options, keep Include column names ticked; optionally tick Remove linebreaks from contents and Open file after creation.
- Click OK.
What "Excel CSV" does differently
HeidiSQL has two CSV formats. Delimited text uses the field separator, encloser and line terminator you choose. Excel CSV fixes these for Excel, according to the dialog's source code:
- Separator. Tab when copying to the clipboard (so it pastes into cells), a semicolon when your system's decimal separator is a comma (common in Europe), and a comma otherwise.
- Encloser and line ends. Double quotes and Windows line breaks.
- UTF-8 BOM. When writing a UTF-8 file, HeidiSQL adds a byte order mark, which newer Excel versions need to show accented characters correctly.
- Dates. Milliseconds are removed from date and time values, because Excel does not support them.
If you need a real .xlsx workbook, open the CSV in Excel and save it as a workbook. HeidiSQL does not write .xlsx files.
All export formats
The NULL value option sets the text written for NULLs in the CSV and Markdown formats. Since 12.18 there is also an option to export only the focused column, and Include SQL query adds the query to the output.
| Format | File extension | Typical use |
|---|---|---|
| Excel CSV | .csv | Opening in Excel |
| Delimited text | .csv | CSV or TSV with your own separators |
| HTML table | .html | Reports and email |
| XML | .xml | Data exchange |
| SQL INSERTs, INSERT IGNOREs, REPLACEs, DELETEs/INSERTs, UPDATEs | .sql | Moving rows to another database |
| LaTeX, Textile, Jira Textile | .LaTeX, .textile, .jira-textile | Documents and tickets |
| PHP Array | .php | Fixtures in PHP code |
| Markdown Here | .md | Documentation |
| JSON, JSON Lines | .json, .jsonl | APIs and data pipelines |
Exporting all rows, not just the visible ones
All loaded rows means the rows HeidiSQL has fetched into the grid. On a table's Data tab, HeidiSQL loads rows in chunks; use Show all (Ctrl+Alt+End) to load every row before exporting, or write a SELECT in a query tab, which returns the full result. For very large tables, consider exporting the whole table as SQL with Tools > Export database as SQL, which the help page describes as similar to mysqldump, or a server-side tool, rather than going through the grid.
Quick copy to the clipboard
For a small result, choose Copy to clipboard as the output target with Excel CSV; HeidiSQL then uses tabs so the rows paste straight into spreadsheet cells. Save clipboard settings remembers these options. The Edit menu also has Copy column names and an option to copy all lines of a listing in CSV format.
Frequently asked questions
Can HeidiSQL export to .xlsx?
No. HeidiSQL exports an "Excel CSV" file that Excel opens directly; save it as .xlsx in Excel if you need a workbook.
Why does my HeidiSQL CSV open in one column in Excel?
Your regional settings probably expect a semicolon. Use the Excel CSV format, which picks a semicolon when the system decimal separator is a comma, or set the separator yourself in Delimited text.
Why are accented characters wrong in Excel?
Export as UTF-8 with the Excel CSV format, which adds the byte order mark newer Excel versions need. Delimited text does not add it.
Can HeidiSQL export query results to JSON?
Yes, JSON and JSON Lines are both output formats in Export grid rows.
How do I export a whole database?
Use Tools > Export database as SQL, which writes CREATE and INSERT statements to a file, a ZIP, the clipboard or another server.
Sources
- HeidiSQL home page (export formats)
- HeidiSQL help: SQL export
- HeidiSQL v12.18 release notes
- HeidiSQL source: main window actions (main.dfm)
- HeidiSQL source: Export grid rows dialog (exportgrid.dfm)
- HeidiSQL source: export logic (exportgrid.pas)
Checked 8 October 2026.
How we research tool guides: our editorial method. CodeWithSQL earns nothing from the vendors mentioned.