This topic demonstrates how to decrypt Excel file in C#. It shares the IDE setup instructions and the procedural steps along with a functional code sample to decrypt Excel file with password in C#. Furthermore, it also outlines the options to tailor the decryption workflow to suit your needs.
Steps to Decrypt Excel in C#
- Setup the system to use Aspose.Cells to decrypt Excel spreadsheets
- Create an instance of the LoadOptions class
- Load the Excel spreadsheet using the Workbook class
- Decrypt the Excel file
- Write the output file without encryption and password protection
The above instructions guide how to decrypt password protected Excel file in C#. Start by opening the encrypted Excel file, providing the matching password, and removing the encryption. To wrap up, write the generated unlocked version of the Excel file.
Code to Decrypt XLSX File in C#
This short code example demonstrates how to decrypt XLSX file in C#. Initially, the password is set using the LoadOptions class, followed by parsing the file via the Workbook class. After that, the password is stripped from the file, making it fully accessible. In addition, the approach can be enhanced to handle multiple encrypted files with the same or varying passwords depending on specific use cases.
This article covered the necessary steps to decrypt XLSX in C#. To explore how to extract data from Excel documents, check out our guide Read Excel File in C#.