0

Currently i am using String data= sheet1.getRow(row).getCell(column).getStringCellValue(); It works properly for String value but displays error for numeric value. So i have to add numeric value like "34567" in excel. Is there any other method to fetch both numeric and String ?

2 Answers2

1

You will get an error when you try to fetch the numeric cell as String.

You should be setting the cellType as string like below, before fetching the numeric cell.

   HSSFCell yourCell = sheet1.getRow(row).getCell(column);
   yourCell.setCellType(Cell.CELL_TYPE_STRING);
   String data = yourCell.getStringCellValue();
Vijay
  • 542
  • 4
  • 15
0

in the template excel change the column type as string.then get the value as string as follows sheet1.getRow(row).getCell(column).getStringCellValue().Then pasrse to integer or whatever.

Ajay
  • 87
  • 7