I am developing a web application which reads data from excel file (xlsx). I am using POI for reading excel sheet. The problem is when I try to read excel file, the server throws the following error:
The excel file I am trying to read has size of almost 80 MB. Any solution to this problem?
Actually user is uploading file and application after saving file to disk try to read file. The code snippet I am using for testing is:
File savedFile = new File(file_path);
FileInputStream fis = null;
try {
fis = new FileInputStream(savedFile);
XSSFWorkbook xWorkbook = new XSSFWorkbook(fis);
XSSFSheet xSheet = xWorkbook.getSheetAt(5);
Iterator rows = xSheet.rowIterator();
while (rows.hasNext()) {
XSSFRow row = (XSSFRow) rows.next();
Iterator cells = row.cellIterator();
List data = new ArrayList();
while (cells.hasNext()) {
XSSFCell cell = (XSSFCell) cells.next();
System.out.println(cell.getStringCellValue());
data.add(cell);
}
}
} catch (IOException e) {
e.printStackTrace();
}