GerardDellemann commented on a change in pull request #234: MM-82 Detect Column Types URL: https://github.com/apache/metamodel/pull/234#discussion_r354305322
########## File path: excel/src/main/java/org/apache/metamodel/excel/ExcelUtils.java ########## @@ -222,7 +222,62 @@ public static String getCellValue(Workbook wb, Cell cell) { } else { // TODO: Consider not formatting it, but simple using // Double.toString(...) - result = _numberFormat.format(cell.getNumericCellValue()); + result = getNumericCellValueAsStringUsingBuildinFormat(cell.getCellStyle(), cell.getNumericCellValue()); + } + break; + case STRING: + result = cell.getRichStringCellValue().getString(); + break; + default: + throw new IllegalStateException("Unknown cell type: " + cell.getCellType()); + } + + logger.debug("cell {} resolved to value: {}", cellCoordinate, result); + + return result; + } + + public static Object getCellValueAsObject(final Workbook wb, final Cell cell) { + if (cell == null) { + return null; + } + + final String cellCoordinate = "(" + cell.getRowIndex() + "," + cell.getColumnIndex() + ")"; Review comment: Actually, it's being used in so many places. I made a static method for this. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services