This is the exception I am getting:
org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
The file I am trying to open is an .xls file, I searched for possible solutions, I found this and this, but I am already doing this correctly, so this is not the problem.
My code:
InputStream file = new FileInputStream(new File(path));
org.apache.poi.ss.usermodel.Workbook workbook = WorkbookFactory.create(file);
org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(sheetNumber);
sheetNumber is an int (It´s always 0 in my software) and the path is correct, I tested these two many times before posting this, to make sure I am not failing there. The line that is throwing the exception is:
org.apache.poi.ss.usermodel.Workbook workbook = WorkbookFactory.create(file);
(If you want more details on the code, you can find the whole class Here)
Does anyone know where can I be failing? Thank you all.