I am trying to read xls and xlsx files with below code and get data from it but i am able to read 70% of xl files i am having but for some i am getting below errors for remaining files some are giving 1st error and some are giving 2nd error
1)java.lang.IllegalArgumentException: The supplied POIFSFileSystem does not contain a BIFF8 'Workbook' entry. Is it really an excel file?
2)java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream
Both above errors are coming for xlsx extension files
Why am i able to read some and not some files and is there any global solution to this
My java code:
FileInputStream input = new FileInputStream("/Users/Xl_Files/"+fileName);
Workbook wb = WorkbookFactory.create(input);
Sheet sheet = wb.getSheetAt(0);
String var = String.valueOf(sheet.getRow(Row).getCell(Colon));