- To export a query result, click Export Data on the result toolbar, choose the Excel (xlsx) or CSV extractor, and click Export to File.
- Ctrl+C copies only the selected rows on the current page of results; use Export Data or Export Table to Clipboard for the full result.
- For Excel, the Output query to a separate sheet option adds a sheet containing the SQL that produced the data.
- To export whole tables, right-click them in the Database Explorer and choose Import/Export | Export Data to File; each table becomes its own file.
DataGrip export to Excel from a query result
This is the usual DataGrip export to Excel route for the output of a query:
- Run the query in a query console (Ctrl+Enter on Windows, Cmd+Enter on macOS). The result appears in the results tab.
- On the result toolbar, click Export Data.
- In the Export Data dialog, set Extractor to Excel (xlsx).
- Choose the options you need: Add column header for a header row, Add row header for row numbers, Transpose to swap rows and columns, and Output query to a separate sheet to add a Query sheet holding the SQL.
- Set the Output file and click Export to File.
The export takes the full result, not only the rows on screen. The Excel extractor writes .xlsx or .xls.
Export query results to CSV
The steps are the same with the CSV extractor selected. DataGrip quotes cells that contain commas, so values such as "Ortiz, Daniel" survive the round trip. For semicolon, tab or pipe-separated output, open the extractor list and choose Configure CSV Formats: there you can define the value and row separators, the text written for NULL, the quotation characters and when values are quoted (Never, When needed or Always). New formats then appear in the extractor list.
The extractor you choose last becomes the default for new editor tabs, so check the list before your next export.
Formats you can export to
You can also write your own extractor in Groovy or JavaScript and place it in the extractors folder under Scratches and Consoles | Extensions | Database Tools and SQL | data.
| Extractor | File format | Typical use |
|---|---|---|
| Excel | .xlsx, .xls | Spreadsheets for colleagues |
| CSV, TSV | .csv, .tsv | Loading into other tools and databases |
| Pipe-separated | .txt | Plain-text tables |
| JSON | .json | APIs and scripts |
| Markdown, HTML (Groovy or JavaScript) | .md, .html | Documentation and reports |
| XML | .xml | Systems that expect XML |
| SQL Inserts, SQL Updates, SQL-Insert-Multirow, SQL-Insert-Statements | .sql | Moving rows to another database |
| Pretty | .txt | Readable fixed-width text |
Copying results to the clipboard
- Ctrl+C copies only the selected cells on the current page of results.
- Ctrl+A then Ctrl+C copies every row on the current page.
- Export Data | Copy to Clipboard, or right-click a cell and choose Export Table to Clipboard, copies the full result using the current extractor.
Choosing a TSV or CSV extractor before copying makes the clipboard paste cleanly into a spreadsheet. If you only see part of a large result, the page size is limited in Settings | Database | Data Editor and Viewer; that limits what is displayed and copied with Ctrl+C, while Export Data still takes everything.
Export whole tables, structure and full dumps
Tables. In the Database Explorer, select one or more tables or views, right-click and choose Import/Export | Export Data to File. A separate file is created for each table or view.
Structure. DataGrip exports structure and data separately. For DDL, right-click an object and choose SQL Scripts | SQL Generator (Ctrl+Alt+G), or Generate DDL to Query Console or Generate DDL to Clipboard.
Full dumps. For a backup-style dump DataGrip runs the database's own tools: Export with 'mysqldump' for MySQL, Export with 'pg_dump' for PostgreSQL and Export with 'bcp' for SQL Server tables. These tools are not part of DataGrip, so you give the full path to the executable.
Frequently asked questions
How do I export a DataGrip query result to Excel?
Click Export Data on the result toolbar, choose the Excel (xlsx) extractor, set the output file and click Export to File.
Why did DataGrip copy only some of my rows?
Ctrl+C copies the selection on the current page only. Use Export Table to Clipboard or Export Data to take the whole result.
Can DataGrip include the SQL query in the Excel file?
Yes. Select Output query to a separate sheet in the Export Data dialog; DataGrip adds a Query sheet with the SQL.
Can I export several tables at once?
Yes. Select them in the Database Explorer and choose Import/Export | Export Data to File. Each table is written to its own file.
How do I export to CSV with a semicolon delimiter?
Choose Configure CSV Formats in the extractor list, add a format with a semicolon value separator, and select it before exporting.
Sources
- DataGrip documentation: Export
- DataGrip documentation: Data extractors
- DataGrip documentation: Run queries
Checked 8 October 2026.
How we research tool guides: our editorial method. CodeWithSQL earns nothing from the vendors mentioned.