Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Talend Routine Not working for POIFileSystem

I have an requirement to process .xlsx file which is password protected. I have used below code to 

POIFSFileSystem fileSystem = new POIFSFileSystem(new File(excelFilePath));

EncryptionInfo info = new EncryptionInfo(fileSystem);
Decryptor d = Decryptor.getInstance(info);

try {
if (!d.verifyPassword("xyz")) {
throw new RuntimeException("Unable to process: document is encrypted");

}
}
catch (GeneralSecurityException ex) {
throw new RuntimeException("Unable to process encrypted document", ex);
}

OPCPackage dataStream = OPCPackage.open (d.getDataStream(fileSystem)) ;

 

Getting error : 

The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)

 

The same code works fine in Eclipse, But Not woking in Talend.

I have used below Jars in Eclipse and Talend

commons-collections4-4.1

poi-3.17

poi-ooxml-3.17

poi-ooxml-schemas-3.17

xerces-2.9.0

xmlbeans-2.6.0

 

Please suggest if any Jar should be updated / added for the code to work in Talend 

 

// The package open is instantaneous, as it should be.

Labels (3)
1 Reply
Anonymous
Not applicable
Author

Hello,

So far, talend don't handle passwords in the Excel components, so it's impossible to read a file protected which can only be accessed with a password.

We suppose that the Apache POI library supports the password encryption in various manner.

Here is a custom component tFileExcelWorkbookOpen written by talend community user and shared on talend exchange portal. It can support for password protected files.

Hope it will shed some light for you.

Best regards

Sabrina