This quick tutorial explains the process to unhide Excel sheet using C#. It contains the configuration details, a sequence of steps to be followed while writing the application to unhide all sheets in Excel using C#, and finally a runnable sample code to demonstrate the complete process. You will also learn the process to unprotect a workbook with or without a password and save the resultant workbook on the disk as an XLSX, XLS, or any other supported format.
Steps to Unhide Multiple Sheets in Excel using C#
- Establish the environment to use Aspose.Cells for .NET to unhide the sheets
- Load the source workbook having hidden sheets in it
- Unprotect the protected workbook by providing the password if required
- Parse through all the sheets in the workbook
- Set the IsVisible flag to true if a sheet is not visible
- Save the resultant workbook with all the unhidden sheets
These steps describe the process to show Excel hidden sheets using C# with the help of necessary steps to configure the IDE and then load the source workbook. An optional step is there to unprotect the workbook before unhiding the hidden worksheets. In the final step, all the worksheets in the workbook are parsed and their IsVisible flag is set to true after checking the existing visible status of each worksheet.
Code to Unhide Sheet using C#
This code demonstrates the process to unhide spreadsheet using C#. It loads the existing workbook having hidden sheets in it and then Unprotect() method is called along with the optional password to unprotect the workbook. You can also unprotect the workbook without using a password and even skip this step before unhiding sheets in a password-protected workbook.
In this tutorial, we have learned how to unhide Excel sheet using C#. If you want to know the process to save the resultant file as PDF, refer to the article on how to save Excel file as PDF using C#.