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 ?

0

2 Answers 2

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();
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot vijay .. it works for me .. :) Appreciate your knowledge :) @vijay
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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.