private String[] getFirstRow(Sheet sheet) { Row firstRow = sheet.getRow(0); int totalColumns = headerRow.getPhysicalNumberOfCells(); if (totalColumns > 0){ String[] columnHeaders = new String[totalColumns]; for (int count=0; count<columnHeaders.length; count++){ columnHeaders[count] = getValue(headerRow.getCell(count)); } return columnHeaders; } return null; }