0

Following is the peace of code which i'm trying to read large excel sheet in to java level. This code works fine when my excel sheet input is small. But when I'm trying to read large excel sheet (size is about 5MB and 100000 records) it return a exception

java.io.IOException: inputstream is closed

      try {

            InputStream excelFile = new FileInputStream(excel);
            XSSFWorkbook  workbook =new XSSFWorkbook(excelFile);
              if(excelFile!=null){
                    excelFile.close();
                }

        } catch (Exception e) {
            e.printStackTrace();
        }

what is the reason for that? Is there any alternative ways to read large excel sheets in Apache POI.

Nwn
  • 561
  • 2
  • 9
  • 33
  • you can see here: https://stackoverflow.com/questions/7274076/writing-a-large-resultset-to-an-excel-file-using-poi – Joe Taras Jul 19 '18 at 13:03
  • `https://poi.apache.org/apidocs/org/apache/poi/ss/SpreadsheetVersion.html` there are the limitations for both excel versions. What happens if you use `new XSSFWorkbook(new File(excelFile))`? – XtremeBaumer Jul 19 '18 at 13:11

0 Answers0