We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hide/Unhide sheets using password


Can password be used to hide/unhide sheets?
I am using Aspose.cells fro .net version


Thanks for your query.

I think this feature (hide/unhide worksheet using password) is not available in MS Excel either (using its options and menu commands). Aspose.Cells follows MS Excel standards and specifictions, so if something is not done in MS Excel manually, it cannot be done by Aspose.Cells APIs. Anyways, if you find this can be done in MS Excel manually, kindly provide complete details and steps involved to accomplish the task, we will check on how to do it via Aspose.Cells APIs.

Furthermore, we recommend you to protect a worksheet instead via Aspose.Cells APIs. You may password protect a whole worksheet, so if any user needs to edit the worksheet, he has to provide a valid password to do that. See the documents in the section for your reference:

thanks for the reply.

Here is what you do in Excel

In your sheet of interest, go to Format->Sheet->Hide and hide your sheet.
Go to File->Protect workbook->Protect Workbook structure, and enter your password of choice.
Once this is done, the sheet is hidden and cannot be unhidden without the password.


Thanks for the details.

See the following sample code to accomplish your task via Aspose.Cells APIs for your reference.
Sample code:

Workbook workbook = new Workbook("e:\\test2\\Book1.xlsx");

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Hiding the first worksheet of the Excel file
worksheet.IsVisible = false;
// Protecting the workbook with a password "1234".
workbook.Protect(ProtectionType.All, "1234"); 


Hope, this helps a bit.

Thanks. This works for me.


Good to know that the suggested code figures out your issue now. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

Hello @Amjad_Sahi

is their any way in aspose cells using which we can get the sheet of excel workbook which is hidden and protected in the workbook.

I did tried using “wb.getWorksheets.get(“sheetname”)” sheet name which is hidden and protected in excel workbook. If you have any suggestion then please give

Thanks in advance


You may evaluate if a worksheet is hidden or not via wb.getWorksheets().get("sheetname").isVisible() attribute. And, you may check if a worksheet is protected via wb.getWorksheets().get("sheetname").isProtected() attribute for your needs.