Possible Duplicate:
How can I access password protected Excel workbook in Java using POI api
How to open a password protected Word/Excel-file using Apache POI in Java ? Please, write the code.
Possible Duplicate:
How can I access password protected Excel workbook in Java using POI api
How to open a password protected Word/Excel-file using Apache POI in Java ? Please, write the code.
Apache POI support for reading encrypted XLSX and DOCX files. Refer the Apache POI documentation
Your code should be something like this:
EncryptionInfo info = new EncryptionInfo(filesystem);
Decryptor d = Decryptor.getInstance(info);
try {
if (!d.verifyPassword(password)) {
throw new RuntimeException("Unable to process: document is encrypted");
}
InputStream dataStream = d.getDataStream(filesystem);
HSSFWorkbook wb = new HSSFWorkbook(dataStream);
// parse dataStream
} catch (GeneralSecurityException ex) {
throw new RuntimeException("Unable to process encrypted document", ex);
}