I needed to initialize about 500 cells for the Excel table and then fill them. I did the initialization through the array.
private void write(String PATH) { try { InputStream inp = new FileInputStream(PATH + "\\workbook.xlsx"); Workbook wb = null; try { wb = WorkbookFactory.create(inp); } catch (EncryptedDocumentException | InvalidFormatException e) { e.printStackTrace(); } Sheet sheet = wb.getSheetAt(1); int rowCounter = 0; Cell[] mas = new Cell[500]; List<Cell> cellList = new LinkedList<Cell>(); for (int i = 0; i < getFinishFile().size(); i++) { Row row = sheet.createRow(rowCounter++); for (int j = 0; i < mas.length; i++) { mas[i] = row.createCell(j); cellList.add(mas[i]); } int j = 0; for (Cell c : cellList) { c.setCellValue(getFinishFile().get(i)[j]); j++; } } FileOutputStream fileOut = new FileOutputStream(PATH + "\\workbook.xlsx"); wb.write(fileOut); fileOut.close(); } catch (IOException e) { e.printStackTrace(); } } But can it be done somehow faster and more locally?