youngcm2 / CsvHelper.Excel

Apache License 2.0
66 stars 34 forks source link

Support for password protected files #34

Closed CasperWSchmidt closed 1 year ago

CasperWSchmidt commented 1 year ago

Is your feature request related to a problem? Please describe. We receive excel files from external vendors and they have decided to password protect the files. Therefore we need support for unprotecting the file.

Describe the solution you'd like ClosedXML already has support for IXLWorkbook.Unprotect(string password) so this needs to be called before ExcelParser tries to handle stuff in its constructor. I'm not sure what is the best way to support this - by configuration or a new constructor overload? I'm happy to make a PR.

Describe alternatives you've considered I already tried using parser.Workbook.Unprotect(password) but I never get there because the creation of parser fails.

CasperWSchmidt commented 1 year ago

Upon further investigation, it looks like ClosedXML does not have support for decrypting encrypted excel files (CFB format).