How to set formula in Excel with POI?

I want to generate a Excel sheet with Apache POI. One cell should contain a formula. Unfortunately, it doesn’t work. I get an error in the Excel sheet. Code public static void main(String[] args) throws FileNotFoundException, IOException { Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet("Test"); Row row = sheet.createRow(2); Cell cell = row.createCell(0);… Read More How to set formula in Excel with POI?

How to insert a null value in Excel from Java code using ApachePOI

I have a one field with admissionDate in Student object, which is suppose should be null anytime When am inserting that value into the excel using apache poi i am getting NullPointerException. Data type of admissionDate is Date Below is my code Row studentRow = studentSheet.createRow(0); studentRow.createCell(0).setCellValue("Id"); studentRow.createCell(1).setCellValue("Name"); studentRow.createCell(2).setCellValue("Admission_Date"); int studentCount = 1; for(Student student… Read More How to insert a null value in Excel from Java code using ApachePOI