A
A
artshelom2017-05-09 13:39:08
Java
artshelom, 2017-05-09 13:39:08

Error writing a large number of rows in excel??

Approximately at line 32 in excel, it writes the following error: java.lang.NullPointerException, the variable is not empty I
write it this way:

FileInputStream file = new FileInputStream(new File("excel/excel.xlsx"));
            XSSFWorkbook workbook = new XSSFWorkbook(file);
            XSSFSheet sheet = workbook.getSheetAt(0);
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm");
            for (int i=0;i<statistics.getList().size();i++){
                Row row = sheet.getRow(i);
                row.createCell(0).setCellValue(dateFormat.format(statistics.getList().get(i+1).getDate()));
            }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
artshelom, 2017-05-09
@artshelom

If suddenly someone solves the issue by replacing: Row row = sheet.getRow(i); on Row row = sheet.createRow(i);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question