@Test void getNumberOfSheetsTestCSV() { File file = ResourceUtils.getFile(getClass(), "/test.csv"); assertEquals(-1, getNumberOfSheets(file)); }
public static int getNumberOfSheets(File file) { if (!isExcelFile(file.getName())) return -1; try (FileInputStream fis = new FileInputStream(file); Workbook workbook = WorkbookFactory.create(fis)) { return workbook.getNumberOfSheets(); } catch (Exception e) { throw new MolgenisDataException(e); } }
ExcelUtils { public static int getNumberOfSheets(File file) { if (!isExcelFile(file.getName())) return -1; try (FileInputStream fis = new FileInputStream(file); Workbook workbook = WorkbookFactory.create(fis)) { return workbook.getNumberOfSheets(); } catch (Exception e) { throw new MolgenisDataException(e); } } }
ExcelUtils { public static int getNumberOfSheets(File file) { if (!isExcelFile(file.getName())) return -1; try (FileInputStream fis = new FileInputStream(file); Workbook workbook = WorkbookFactory.create(fis)) { return workbook.getNumberOfSheets(); } catch (Exception e) { throw new MolgenisDataException(e); } } private  ExcelUtils(); }
ExcelUtils { public static int getNumberOfSheets(File file) { if (!isExcelFile(file.getName())) return -1; try (FileInputStream fis = new FileInputStream(file); Workbook workbook = WorkbookFactory.create(fis)) { return workbook.getNumberOfSheets(); } catch (Exception e) { throw new MolgenisDataException(e); } } private  ExcelUtils(); static void renameSheet(String newSheetname, File file, int index); static int getNumberOfSheets(File file); static boolean isExcelFile(String filename); }
ExcelUtils { public static int getNumberOfSheets(File file) { if (!isExcelFile(file.getName())) return -1; try (FileInputStream fis = new FileInputStream(file); Workbook workbook = WorkbookFactory.create(fis)) { return workbook.getNumberOfSheets(); } catch (Exception e) { throw new MolgenisDataException(e); } } private  ExcelUtils(); static void renameSheet(String newSheetname, File file, int index); static int getNumberOfSheets(File file); static boolean isExcelFile(String filename);  }