I have a stored procedure. This proc returns some data that needs to be put in an excel format. Is it possible to create a excel file to have the result of a select statement from the database? please help me out.


6 Years
Discussion Span
Last Post by buddylee17

If you're looking to have your stored procedure directly output Excel-formatted data, then no it can't be done. You could use CLR to do some object manipulation, but that's a real pain.

If you execute your stored procedure in SSMS, you can output to a grid, then right-click any header cell and save the results as a .CSV file (which Excel will pick up) but you can't specify special Excel formatting.

However, if you want to automate (as in, a batch job to output an Excel file) your best bet is to use SSIS to execute your stored proc and pump the results out to an Excel file. Or, if it's a onesy-twosy kind of thing, you could execute your stored procedure from Excel directly.

Hope this gives you some ideas. Good luck!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.