Other API Samples

Live SpreadsheetGear API Samples

Workbook Opening Password-Protected Files

SpreadsheetGear supports reading and writing encrypted workbooks with Agile Encryption used by Excel 2013 and later, including default SHA-512 encryption for workbooks.

// First create an empty workbook set.
SpreadsheetGear.IWorkbookSet workbookSet = SpreadsheetGear.Factory.GetWorkbookSet();

// Now open password-protected file within this workbook set, specifying the password as the second argument.
SpreadsheetGear.IWorkbook workbook = workbookSet.Workbooks.Open(@"c:\path\to\workbook.xlsx", "MyPassword1234");