Excel Decryption for XLS in C# and VB.NET

XLS decryption enables you to read files that are encrypted with a password. To read a protected or encrypted Excel workbook, you'll need to provide a XlsLoadOptions.Password value.

Note that GemBox.Spreadsheet currently doesn't support encrypting XLS files (saving password protected XLS files), but it does support encrypting XLSX files.

The following example shows how to load an encrypted XLS file and save it as a decrypted XLS file in C# and VB.NET.

Decrypting Excel file of XLS format in C# and VB.NET
Screenshot of Excel workbook's decryption
Upload your file (Drag file here)
using GemBox.Spreadsheet;

class Program
{
    static void Main()
    {
        // If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");

        var inputPassword = "%InputPassword%";

        var workbook = ExcelFile.Load("%InputFileName%",
            new XlsLoadOptions() { Password = inputPassword });

        workbook.Save("Decrypted File.xls");
    }
}
Imports GemBox.Spreadsheet

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY")

        Dim inputPassword = "%InputPassword%"

        Dim workbook = ExcelFile.Load("%InputFileName%",
            New XlsLoadOptions With {.Password = inputPassword})

        workbook.Save("Decrypted File.xls")

    End Sub
End Module

Want more?

Next example GitHub

Check the next example or select an example from the menu. You can also download our examples from the GitHub.


Like it?

Download Buy

If you want to try the GemBox.Spreadsheet yourself, you can download the free version. It delivers the same performance and set of features as the professional version, but with some operations limited. To remove the limitation, you need to purchase a license.