My aim is to read an Excel file using POI and print the values present in it. If the value is 5, then my output must be 5, but it is returning as 5.0.
Below is the code that I have tried:
FileInputStream fileInputStream = null;
XSSFSheet xssfResultSheet = null;
String filePath = "C:\\MyXcel.xlsx";
fileInputStream = new FileInputStream(new File(filePath));
XSSFWorkbook workbook = null;
workbook = new XSSFWorkbook(fileInputStream);
xssfResultSheet = workbook.getSheet("Sheet1");
int iRowCount = xssfResultSheet.getLastRowNum();
for (int i = 1; i <= iRowCount; i++) {
Row resultRow = xssfResultSheet.getRow(i);
System.out.println(resultRow.getCell(0));
}
My Excel sheet has values 1, 2, 3 but my output is 1.0, 2.0, 3.0. Instead my output should also be 1, 2, 3.
