code: public static int findMaxCol(Sheet sheet) {
          int maxCol = 0;
          for (int i = 0, ii = sheet.getLastRowNum(); i <= ii; ++i) {
              val row = sheet.getRow(i);
              if (row == null) continue;
  
              for (int j = row.getLastCellNum() - 1; j > maxCol; --j) {
                  val cell = row.getCell(j);
                  if (cell == null) continue;
  
                  val value = getCellStringValue(cell);
                  if (StringUtils.isNotEmpty(value)) {
                      maxCol = j;
                      break;
                  }
              }
          }
  
          return maxCol;
      }
docs: 查找有值得最大列索引。
  
  @param sheet 表单
  @return 最大列索引