1

enter image description here

static Workbook book;
static Sheet sheet;

public static Object[][] getTestData(String sheetName) { FileInputStream file = null; try { file = new FileInputStream(TESTDATA_SHEET_PATH); } catch (FileNotFoundException e) { e.printStackTrace(); } try { book = WorkbookFactory.create(file); } catch (InvalidFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } sheet = book.getSheet(sheetName); Object[][] data = new Object[sheet.getLastRowNum()][sheet.getRow(0).getLastCellNum()]; // System.out.println(sheet.getLastRowNum() + "--------" + // sheet.getRow(0).getLastCellNum()); for (int i = 0; i < sheet.getLastRowNum(); i++) { for (int k = 0; k < sheet.getRow(0).getLastCellNum(); k++) { data[i][k] = sheet.getRow(i + 1).getCell(k).toString(); // System.out.println(data[i][k]); } } return data; }

Unfortuantely instead of zipcode 16946 I get the "16946.0" and for phone number i get "9.9839293847" in the console output. How this should be formatted to receive the exact number?

João Farias
  • 10,876
  • 2
  • 18
  • 39

1 Answers1

0

Found solution outside of my social network - Enter number like this '16946 and save in excel row (This ' Single quote convert the value into numeric one)