Excel Sheets exported from SSRS can have custom name

We keep wondering to provide custom name to exported excel file from SSRS. SQL Server Reporting Services 2008 R2 has provided an easy way to do so. I will explain you with an example how?

For this example I’ll be starting off from the report created for Payables Consolidations in Dynamics GP.

The Scenario

Payables Transaction Entry has different kind of Document types like Invoice, Payment, Credit Memo, Finance Charge and Misc Charge. When the report gets exported to Excel, each document should get its own sheet name based on document type. So all documents from the invoice category should be located in a sheet called “Invoice”, all payments in a sheet called “Payment”, and so on.

The Report

Starting Position

Let’s first have a quick look what the export to Excel currently looks like, without any modifications to the report.


All records are being exported to just one sheet.  And, by default, the name of the sheet is the name of the report.  (I made a copy of my existing report and called it Payables_Consolidation.rdl.)

In case you want to change the default name of the sheet, it’s possible.  On the report itself, there’s a property called InitialPageName.


Fill in a value and here’s the result in Excel:


Adding The DOCTYPE Group

To be able to get the different document type into different sheets, we need to add a group on Document Type to the tablix in the report.

With the tablix selected, right-click the Details line in the Row Groups pane and select Add Group > Parent Group.  Select DocType as field to group by and activate the Add group header checkbox.


Remove the group column that gets added automatically and move the header cells from the main header to the group header.  Delete the main header row so that you end up with something like this:


Open up the Group Properties by double-clicking the new DocType item in the Row Groups pane.  Select the Page Breaks page and activate the Between each instance of a group checkbox.  Doing this ensures that each group gets its own page in the report, and its own sheet in Excel.


Let’s render the report and export to Excel to have a look at the effect of adding these page breaks.


Indeed, every group has gotten its own worksheet.  However, they’ve also gotten the very original names such as Sheet1, Sheet2 and so on.

Customizing The Names Of The Sheets

On to the final part of the requirements: giving our own customized name to the generated Excel sheets.  This is actually really easy once you know how to do this.

First select the DocType group in the Row Groups pane so that its properties are displayed in the Properties pane.  In the Properties pane, locate the Group > PageName property and specify the following expression:


That’s it, that’s all you need to do!  Don’t believe me?  Here’s what the export to Excel now looks like:



As we’ve seen in this article, it really doesn’t take too much effort to implement a custom name for the worksheets when exporting a report to Excel.

Written By: Sunil Chaudhary (Dynamics GP Team, Cipher Dynamics)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s