If I understand the question, you want to read the data from excel column-wise. i.e. read the entire Column1 and then move to Column2 and so on.
If that is your requirement, Please find for the code snippet in java.
// Getting List of Column Headers in the sheet and saving the same to a list
int masterSheetColumnIndex = sheet.getColumns();
List<String> ExpectedColumns = new ArrayList<String>();
for (int x = 0; x < masterSheetColumnIndex; x++) {
Cell celll = sheet.getCell(x, 0);
String d = celll.getContents();
System.out.println("d : "+d);
ExpectedColumns.add(d);
}
columnDataValues = new LinkedHashMap<String, List<String>>();
List<String> column1 = new ArrayList<String>();
// read values from excel sheet for each column
for (int j = 0; j < masterSheetColumnIndex; j++) {
column1 = new ArrayList<String>();
for (int i = 1; i < sheet.getRows()-7; i++) {
Cell cell = sheet.getCell(j, i);
column1.add(cell.getContents());
System.out.println("cell.getContents() : "+cell.getContents());
}
columnDataValues.put(ExpectedColumns.get(j), column1);
}
Please revert in case of any queries in above code.