Load and decrypt an encrypted XLS file in C# and VB.NET

The following example shows how you can use the GemBox.Spreadsheet library to load an encrypted XLS file and save it as a decrypted XLS file in C# and VB.NET.

Upload your file (Drag file here)
using GemBox.Spreadsheet;

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

var inputPassword = "inpass";

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

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

Module Program

Sub Main()

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

Dim inputPassword = "inpass"

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

workbook.Save("Decrypted File.xls")

End Sub
End Module
Screenshot of a decrypted Excel workbook
Screenshot of a decrypted Excel workbook

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

Next steps

GemBox.Spreadsheet is a .NET library that enables you to read, write, edit, convert, and print spreadsheet files from your .NET applications using one simple API.