Following is the code I used for extracting any value from excel sheet. Cell value can be string ,date or long int. Using below code I am able to extract string and date correctly but long int values are coming in as 4.6861230317E10 instead of 46861230317. How to overcome this issue??
Cell = ExcelWSheet.getRow(RowNum).getCell(ColNum);
if(Cell.getCellTypeEnum() == CellType.STRING)
{
System.out.println("check for celltype string");
CellData = Cell.getStringCellValue();
System.out.println("String CellData:"+CellData);
}
else
if(Cell.getCellTypeEnum() == CellType.NUMERIC)
{
System.out.println("checking for celltype numeric");
CellData = fmt.formatCellValue(Cell);
if(CellData.contains("/"))
{
System.out.println("its a date !"+CellData);
}
else if(!CellData.contains("/"))
{
double CellData2 = (double)Cell.getNumericCellValue();
System.out.println("actual double value "+CellData2);
CellData=String.valueOf(CellData2);
System.out.println("its a double int numeric value "+CellData);
}
}
System.out.println("returning cell data "+CellData);
return CellData;