For example, I'm parsing data from an excel sheet to a java project in Eclipse. I'll eventually pass this into a DB of some description but I'm using a system.out.println statement, for now, to see how much of the file is being parsed. This is where my confusion lies, there are 36,616 rows in the excel sheet but the parsing code I'm using only parses from position 33,269 to 36,616, as opposed to 1 to 33,616. I'm confused is this an issue with the parsing code or is it too many rows for the console to handle?
My Parser
public class ExcelReader {
public static final String SAMPLE_XLSX_FILE_PATH = "./LatLongPrice.xlsx";
public static void main(String[] args) throws IOException, InvalidFormatException {
Workbook workbook = WorkbookFactory.create(new File(SAMPLE_XLSX_FILE_PATH));
// Retrieving the number of sheets in the Workbook
System.out.println("Workbook has " + workbook.getNumberOfSheets() + " Sheets : ");
// obtain a sheetIterator and iterate over it
Iterator<Sheet> sheetIterator = workbook.sheetIterator();
System.out.println("Retrieving Sheets using Iterator");
while (sheetIterator.hasNext()) {
Sheet sheet = sheetIterator.next();
System.out.println("=> " + sheet.getSheetName());
}
// Getting the Sheet at index zero
Sheet sheet = workbook.getSheetAt(0);
// Create a DataFormatter to format and get each cell's value as String
DataFormatter dataFormatter = new DataFormatter();
// Obtain a rowIterator and columnIterator and iterate over them
System.out.println("\n\nIterating over Rows and Columns using Iterator\n");
Iterator<Row> rowIterator = sheet.rowIterator();
while (rowIterator.hasNext()) {
Row row = rowIterator.next();
// Iteratating over the columns of the current row
Iterator<Cell> cellIterator = row.cellIterator();
while (cellIterator.hasNext()) {
Cell cell = cellIterator.next();
String cellValue = dataFormatter.formatCellValue(cell);
System.out.print(cellValue + "\t");
}
System.out.println();
}
});
// Closing the workbook
workbook.close();
}