Free Support Forum -

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");"e:\\test2\\out1.xlsx");

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.