Blog Post

Saving to Excel in Azure Data Studio

Azure Data Studio

Azure Data Studio continues to grow on me. I previously wrote about getting my favorite keyboard shortcuts to work, which made me very happy, but now for a feature I love even more – saving result sets to Excel!

Yes, I know, spreadsheets can be evil. They can even be places where good datasets go to die, but it’s important to remember that they’re a necessary evil. Sometimes you just need a result set in a spreadsheet, whether you want it to be in one or not.

In SQL Server Management Studio, there’s no single-step way to save a result set to Excel. Most commonly I will just copy/paste a result set into a spreadsheet, but depending on the size of the result set and the types of data involved, that doesn’t always play nicely.

But Azure Data Studio does it WAY better, trust me. If you want that result set in a spreadsheet, just save it as one and poof – you have an Excel file!

Try It Yourself!

In Azure Data Studio, query the dataset of your choosing. I’m using my Chicago Parking Tickets database. Once you have your results, look at the icons on the right side of the window.

(click to enlarge)

The second icon from the top will save the entire result set to Excel. Click it, pick a filename and folder to save it to and you’re good to go.

But wait – there’s more!

You can also save a subset of the results directly to Excel. Select the rows, columns, or block of interest (you can click and drag to select within the results!) and then right-click. You’ll get a dialog where you can choose to save the selection:

Whichever method you choose, Azure Data Studio makes it very simple to save results directly to a spreadsheet. Happy querying!

Related Posts

By Bob Pusateri

Bob Pusateri is a Microsoft Data Platform MVP, Microsoft Certified Master of SQL Server, speaker, blogger, volunteer, and author who loves finding new and exciting ways to break and fix things. He works as a consultant and architect, specializing in data, virtualization, and cloud technologies.

2 Comments

  • Shelly A

    Hi Bob. I came across this article and have a quick question – is there a way to export to excel and keep the column headers? when I export I loose all my headers Thanks

    • Bob Pusateri

      Hi Shelly!

      Ooh, that’s a great question!

      In Settings, go to Query Editor > Results > Save As Csv: Include Headers and see if that box is checked.

      I realize it only mentions CSV, but in my testing I found that it adds headers to Excel file output as well.

      Bob

Leave a Reply

Your email address will not be published. Required fields are marked *