Can Aspose.Excel open password protected excel file

Hi,

I have an excel file which is protected by password. I need a component which can open the excel file and import the content into a dataset.

I'd like to know if Aspose.Excel can open the protected excel file?


Ying

Hi Ying,

If you file is encrypted with password or protected on workbook level, Aspose.Excel cannot read your file. However, if you just protect the worksheet from being modified, Aspose.Excel can open it.

@Laurence,
Aspose.Excel is no more available and is discontinued. Another latest product Aspose.Cells has replaced it which is much more advanced and rich in terms of features and performance. This product has the capability now to protect Excel files. Here is an example which shows this feature where a file is protected.

// Instantiating a Workbook object
// Opening the Excel file through the file stream
Workbook excel = new Workbook(fstream);

// Accessing the first worksheet in the Excel file
Worksheet worksheet = excel.Worksheets[0];

// Protecting the worksheet with a password
worksheet.Protect(ProtectionType.All, "aspose", null);

// Saving the modified Excel file in default format
excel.Save(dataDir + "output.out.xls", SaveFormat.Excel97To2003);

// Closing the file stream to free all resources
fstream.Close();

Following link contains multiple examples which show different options like protecting particular row, column or a range from editing:
Protecting Worksheets

For a free trial, latest version of this product can be downloaded here:
Aspose.Cells for .NET (Latest Version)

Here is a detailed solution which contains number of ready to run examples.