XlsUtils { public static int getColumnNumberFromCellRef(String lastCell) { StringBuilder letters = new StringBuilder(); StringCharacterIterator iter = new StringCharacterIterator(lastCell); for (char c = iter.first(); c != StringCharacterIterator.DONE; c = iter.next()) { if (!NumberUtils.isNumber(String.valueOf(c))) { letters.append(c); } } return CellReference.convertColStringToIndex(letters.toString()); } private  XlsUtils(); static String getCellValueAsString(Cell cell, FormulaEvaluator formulaEvaluator); static boolean isNewExcelFormat(InputStream inputStream); static List<String> getActiveSheetsFromWorkbookSpec(InputStream inputStream); static int getColumnsNumber(InputStream inputStream); static int getColumnsNumberFromDimension(String dimension); static int getColumnNumberFromCellRef(String lastCell);  }
@Test public void col_number_from_cell_ref() throws Exception { Assertions.assertThat(XlsUtils.getColumnNumberFromCellRef("A5")).isEqualTo(0); Assertions.assertThat(XlsUtils.getColumnNumberFromCellRef("D5")).isEqualTo(3); Assertions.assertThat(XlsUtils.getColumnNumberFromCellRef("A15")).isEqualTo(0); Assertions.assertThat(XlsUtils.getColumnNumberFromCellRef("AG142")).isEqualTo(32); Assertions.assertThat(XlsUtils.getColumnNumberFromCellRef("BB11")).isEqualTo(53); }