1

I want to parse old .xls Excel file, with only one sheet inside. There are no formulas and if it is no much different than it would be if I were using .csv. I just want the values that are there. How can I access the value inside of a certain cell?

First I tried using POI, I wrote my code to discover the error message:

org.apache.poi.hssf.OldExcelFormatException: The supplied spreadsheet seems to be Excel 5.0/7.0 (BIFF5) format. POI only supports BIFF8 format (from Excel versions 97/2000/XP/2003)

I have read the question How to process old excel .xls files using POI? and I couldn't understand (after reading the documentation) how I read the value on a certain cell.

This was the best I could do:

private static String extractExcel(File fileEntry) {
    OldExcelExtractor wb = new OldExcelExtractor(fileEntry);
    return wb.getText();
}

I had two problems here:

  1. It returns a string, a cell by line.
  2. It converts integers to float.
  • Read the source code for the old extractor, then implement your own logic similar to that? – Gagravarr Oct 03 '19 at 19:24
  • Is this the best I can do? Because Python Pandas can read these files. – Matheus Popst de Campos Oct 03 '19 at 22:24
  • 1
    Use Pandas then? Apache POI has low-level record support, it's not too much work to use, the old excel extractor is a great guide to what's needed. Being open source, you can quickly see what's needed for your own logic! – Gagravarr Oct 04 '19 at 08:29

0 Answers0