I am getting NullPointerException
for following code. Could some one please help on this? I am trying to get database values to existing excel sheet.
Statement statement = connect.createStatement();
ResultSet resultSet = statement.executeQuery("select * from basicinfo");
FileInputStream fis = new FileInputStream(new File("exceldatabase.xlsx"));
XSSFWorkbook workbook = new XSSFWorkbook(fis);
XSSFSheet spreadsheet = workbook.getSheetAt(0);
XSSFRow row=spreadsheet.getRow(2);
XSSFCell cell;
cell=row.getCell(2);
cell.setCellValue("user_name");
cell=row.getCell(3);
cell.setCellValue("email");
cell=row.getCell(3);
cell.setCellValue("phonenum");
cell=row.getCell(4);
cell.setCellValue("address");