- In SSMS 22.4.1 and later, right-click the results grid, choose Save Results As, and pick Excel, CSV, TXT, JSON, XML or Markdown in Save as type.
- SSMS 22.3.3 and earlier save only CSV and TXT; update SSMS to get direct Excel export, and to 22.10.2 for the include-headers checkbox and a fix for .xlsx files that misbehaved in Excel.
- For a quick paste into Excel, select the grid and press Ctrl+Shift+C to copy results with column headers.
- For large results, Results to File (Ctrl+Shift+F) writes straight to disk, and bcp with queryout exports from the command line.
SSMS export to Excel or CSV with Save Results As
This is the route most people want. It works on whatever the query returned in Results to Grid, the default output.
- Run the query with results in the grid (Ctrl+D switches the window to grid output).
- Right-click anywhere in the results grid and select Save Results As....
- In the Save Grid Results dialog, enter a file name and choose the format in Save as type.
- In SSMS 22.10.2 and later, tick the checkbox to include column headers if you want them in the file.
- Select Save. SSMS remembers the last file type you used.
If a query returns several result sets, each appears in its own grid; right-click the one you want. The default folder is set in Tools > Options > Query Results > SQL Server > General > Query results directory.
| SSMS version | Formats in Save as type | Notes |
|---|---|---|
| 22.3.3 and earlier | CSV, TXT | Open the CSV in Excel, or copy and paste |
| 22.4.1 (March 2026) and later | CSV, TXT, Excel, JSON, XML, Markdown | Direct .xlsx export added |
| 22.10.2 (September 2026) | As above | Include-headers checkbox in Save Grid Results; fix for .xlsx files that caused selection errors in Excel |
Copy and paste into Excel with headers
For small results, copying is quicker than saving a file. Microsoft lists Ctrl+Shift+C as "Copy the result grid and headers to the clipboard". The grid lets you copy selected rows, columns or the full result set, with or without headers, from the right-click menu. Paste into Excel with Ctrl+V.
Check long numbers and leading zeros after pasting: Excel applies its own type detection to pasted text, which SSMS does not control.
Results to File and Results to Text
Results to File writes the output straight to disk instead of rendering it, which Microsoft suggests for large result sets. Press Ctrl+Shift+F (or use the SQL Editor toolbar), run the query, then choose a folder, file name and Save as type in the Save Results dialog. The default is a report file with the .rpt extension; the arrow on the Save button offers Save with Encoding.
Results to Text (Ctrl+T) prints delimited text in the Results window. The column separator and maximum column width are set in Tools > Options > Query Results > SQL Server > Results to Text. The destination you choose applies to the current query window and takes effect on the next run.
Export whole tables with the Export Data wizard
To export one or more tables (or a query) to an Excel workbook or a flat file without writing results to the grid, use the SQL Server Import and Export Wizard: right-click the database, point to Tasks and select Export Data. In SSMS 22 the wizard comes with the Integration Services component of the Business Intelligence workload.
- Choose your SQL Server database as the source and an Excel workbook or a flat file as the destination on the Choose a Destination page.
- For Excel, enter the Excel file path, choose the Excel version, and set First row has column names.
- You may need to install extra files (the Excel connectivity components) before Excel appears. Microsoft notes the Excel providers are typically 32-bit and are not visible in the 64-bit wizard, so if Excel is missing, that is the usual cause.
- The wizard cannot open a password-protected Excel file.
Large or scheduled exports with bcp
The bcp utility exports from the command line, which suits scheduled jobs and results too large for the grid. queryout copies the result of a query (only the first result set), -c uses character format, -t sets the field terminator (tab by default), -S names the server and -T uses Windows integrated security. bcp writes delimited text, not .xlsx; open the file in Excel afterwards.
bcp "SELECT CustomerID, FullName, City FROM mydb.dbo.Customers" queryout C:\exports\customers.csv -c -t, -S <your-server> -TFrequently asked questions
How do I export SSMS results to Excel?
In SSMS 22.4.1 or later, right-click the results grid, choose Save Results As... and pick the Excel file type. In older versions, save as CSV and open it in Excel, or copy with Ctrl+Shift+C and paste.
How do I include column headers when saving results?
SSMS 22.10.2 added a checkbox to the Save Grid Results dialog to include column headers. When copying, use Ctrl+Shift+C, which copies the grid and headers.
Why does my SSMS .xlsx export show errors in Excel?
SSMS 22.10.2 fixed an issue where .xlsx files exported from SSMS behaved erratically in Excel, including a multiple-selection error. Update SSMS through the Visual Studio Installer and export again.
What is an .rpt file in SSMS?
It is the default file type for Results to File: a plain report-style text file. Choose a different type in Save as type when the Save Results dialog opens.
How do I export a very large result set?
Avoid rendering it in the grid. Use Results to File (Ctrl+Shift+F), the Export Data wizard, or bcp with queryout from the command line.
Sources
- Microsoft Learn: Query results in SQL Server Management Studio
- Microsoft Learn: SSMS 22 release notes
- Microsoft Learn: Tips and tricks for using SSMS
- Microsoft Learn: SSMS keyboard shortcuts
- Microsoft Learn: Start the SQL Server Import and Export Wizard
- Microsoft Learn: Connect to an Excel Data Source (Import and Export Wizard)
- Microsoft Learn: bcp utility
- Microsoft Learn: Components and features in SSMS
Checked 8 October 2026.
How we research tool guides: our editorial method. CodeWithSQL earns nothing from the vendors mentioned.