Apache POI & SXSSF: Number of rows always 0
<p>I use SXSSFWorkbook and SXSSFSheet objects. I am able to write successfully into the excel file:</p>

<pre><code>FileOutputStream fos = new FileOutputStream(fileName);
wb.write(fos);
fos.close();
wb.dispose();
</code></pre>

<p>After writing into the file I am loading/reading it again for further changes. Here is the problem, when I try to get the number of rows with getLastRowNum() I always get 0 as result. Here is a piece of code:</p>

<pre><code>    SXSSFWorkbook wb = null;

    try {
        wb = new SXSSFWorkbook(new XSSFWorkbook(new FileInputStream(fileName)));
    } catch (FileNotFoundException e) {e.printStackTrace();
    } catch (IOException e) {e.printStackTrace();}

    SXSSFSheet sheet = wb.getSheet(sheetName);
    System.out.println(sheet.getLastRowNum());
</code></pre>

<p>Result is 0!
I tried to create my own method using the iterator but that gives me the same result. </p>

<p>I don't have any error messages and if check the name of the sheet (sheet.getSheetName()) it returns the right name but not the right number of rows although the excel file has many simple rows.</p>