Export data from SQL server to Excel in multiple sheets

  • I have a requirement like We need to export data to excel in different sheets in same excel.In breif i can say i have 2 queries and i want the output of these 2 queries in 2 sepearate sheets of same excel.And i don't want to use SSIS or DTS, I want this to be done using T-sql queries as i will be adding these steps in SP.Could some one pleae help me on this

  • This is quite easy with SSRS. Are you familiar with SSRS? First create 2 separate datasets, using the 2 queries you mention. Next, on the report layout, drag and drop a table or matrix, or whatever you need for Sheet1 in the Excel file. Once you're done setting that up, drag and drop a rectangle at the bottom of your report. In the Properties window for the rectangle, locate the "PageBreak" property and set it to End. (Alternatively you can right-click on the rectangle and choose Rectangle Properties, then check the box that says "Add a page break after").

    So in essence, this rectangle is telling SSRS to create a new sheet in your Excel file. So whatever you put on the report after this rectangle will appear on Sheet2!

    Hope this helped!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply