We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

xlsio worksheet (tab) name

Thread ID:





117295 Sep 24,2014 08:16 PM UTC Oct 6,2016 12:39 PM UTC ASP.NET MVC (Classic) 3
Tags: XlsIO
Mike Smith
Asked On September 24, 2014 08:16 PM UTC

I am trying to get the name of an existing worksheet (Sheet1, Sheet2, etc) using the following statements. However, GetSheetNameByReference is an internal protected method so the following does not work.

 IWorkbook workbook = application.Workbooks.Open(d.ResolveApplicationDataPath(@"Products_09172014.xlsx"),

var x = ((WorkbookImpl)workbook).GetSheetNameByReference(0);

Is there another technique to get the sheet name besides trying to use GetSheetNameByReference in this way ?

Sudha Ramachandran [Syncfusion]
Replied On September 25, 2014 06:04 AM UTC

Hi Mike,

Thank you for using Syncfusion products.

Name of the worksheets can be accessed by accessing the worksheets or tabsheets collection as referred in the below code snippet.

Code Snippet:


//Access worksheet name using index of the worksheet

string sheetName = workbook.Worksheets[0].Name;


//Access worksheet name using tab sheet index

string worksheetName = ((IWorksheet)workbook.TabSheets[0]).Name;


Please let us know if you need any clarification.



Sudha R

Catalin Pop
Replied On October 5, 2016 04:25 PM UTC

worksheet.Name = "New Name";                
var newworksheet = workbook.Worksheets.AddCopy(worksheet);
workbook.TabSheets[newworksheet .TabIndex].Name = worksheet.Name;

I'm having a similar problem. I try to change the name of the worksheet but when I save the workbook and open it with Office the names are Sheet2 Sheet3 and so on.

Abirami Varadharajan [Syncfusion]
Replied On October 6, 2016 12:39 PM UTC

Hi Catalin, 

Thank you for contacting Syncfusion support. 

We are unable to reproduce the issue. As you are trying to set same name(New Name) for copied sheet as source worksheet name, the exception is thrown indicates “Name of worksheet must be unique in a workbook.” As per MSExcel behavior. We request you to set different name for copied worksheet as provided below to avoid this exception. 

Code Example: 
            worksheet.Name = "New Name"; 
            worksheet.Range["A1"].Text = "SourceWorksheet"; 
            var newworksheet = workbook.Worksheets.AddCopy(worksheet); 
            workbook.TabSheets[newworksheet.TabIndex].Name = "CopiedWorksheet"; 

We have also shared sample for your reference which can be downloaded from following location. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon