I want to open my excel file with Apache POI.
I don’t know if a file is xls or xlsx. I have only something like this:
InputStream myExcelFile = new ByteArrayInputStream(file.getData());
This way I can open xls file:
HSSFWorkbook hsf = new HSSFWorkbook(myxls);
And this way I can open xlsx file:
XSSFWorkbook xsf = new XSSFWorkbook(myxls);
How can I open both types of files if I don’t know format?