I tried to read the data from excel sheet which was saved as '.xlsx' format then NullPointerExcetion or java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlOptions error I am getting.
But if I change the format of file to '.xls' then able to read. Please let me so that how we can able to read data from xlsx file.
public static String getCellValue(String sheetName, int rowNum, int cellNum) throws InvalidFormatException, IOException{
String cellValue;
System.out.println("getCellValue");
System.out.println("a");
FileInputStream fis = new FileInputStream(xlsPath);
System.out.println("b");
Workbook wb = WorkbookFactory.create(fis);
System.out.println("c");
cellValue = wb.getSheet(sheetName).getRow(rowNum).getCell(cellNum).getStringCellValue();
System.out.println("d");
System.out.println(cellValue);
//cellValue="";
//System.out.println("error "+e.getMessage());
return cellValue;
}