Why Decrypt Excel Worksheet?
To protect our Excel file data information, we can encrypt Excel worksheet by setting password. But we may sometimes forget the password and we can’t read the excel data information neither. So, if this happens we need decrypt Excel worksheet. It’s not easy to decrypt Excel Worksheet which has been encrypted because the reason why we encrypt it is to prevent it from reading by people without password. And now, we do not have password.
How to Use C#/VB.NET to Decrypt Excel Worksheet?
Spire.XLS for .NET, a .NET Excel component which enables .NET applications to fast generate, read, write and modify Excel document without Microsoft Office Excel Automation can help us decrypt Excel worksheet by using C#/VB.NET.
Spire.XLS for .NET presents a very easy solution for developers/programmers decrypting Excel worksheet. We just need sheet.Unprotect( "password" ) method and normal encrypted excel worksheet can be decrypted.
Download Spire.XLS for .NET (or Spire.Office) with .NET framework 2.0 (or above) together. The sample code below will show you how to use C#/VB.NET decrypt Excel worksheet through Spire.XLS for .NET.
C# Decrypt Excel Worksheet
Workbook workbook = new Workbook(); workbook.LoadFromFile("test.xls"); Worksheet sheet = workbook.Worksheets; sheet.Unprotect( "password" ); workbook.SaveToFile("result.xls");
VB.NET Decrypt Excel Worksheet
Dim workbook As Workbook workbook.LoadFromFile("test.xls") Worksheet sheet = workbook.Worksheets(0) sheet.Unprotect( "password" ) workbook.SaveToFile("result.xls")
Spire.XLS allows users to operate Excel document directly such as save to stream, save as web response, copy, lock/unlock worksheet, set up workbook properties, etc. As a professional .NET Excel component, it owns the ability of inserting content into Excel document, formatting cells and converting Excel documents to popular office file formats. Spire.XLS for .NET supports Excel 97-2003, Excel 2007 and Excel 2010. Click to learn more...