JExcelAPI / Excel For Loop


#1


Evening everyone!

I am currently working on a little program to essentially work a tracker program for documents. Long story short, the backbone is simply an Excel sheet. It's not some massive data store or anything so the Excel sheet works just fine. Anyways!

I'm still at a beginner level of Java, although not totally new. In that sort of odd space. I'm currently utilizing JExcelAPI which is doing just well for me currently. The issue is getting my for/if statements to work to dynamically read the Excel sheet to grab the data stored in it. It works.
... Just not as intended entirely. Per the usual.

I'll post the code below- do note I gutted the repetitive code out of it to trim it up. I only left one if statement of ".LABEL" in there for the cellType. Below the label one and the following code there are the other if statements for Number, Boolean, etc. just to the program doesn't break on me one time because I decided to slap in something strange.

Lastly, as I stated the code does work. Just something in the loop- which is probably staring me in the face is incorrect and causing the loop to fail (in my eyes). I've gotten a few variations of the code and the previous version worked better than this one, but since I gutted it I lost the original bit that worked better, however it'll serve the purpose to see if you guys can help me out.

It'll read the cells and keep moving, however regardless of whichever code I used it won't change rows. It has no problem reading down the line of cells, however. Even when I did manage it it wasn't 'quite' right.


Any insight or suggestions are appreciated! Thanks guys. Hopefully I have a right forum for this. My friend suggested I come here.



if (Log != null) {

if (cellCount != 0) {

    for (int Y = 1; Y < cellCount; Y++){

Cell[] CellRange = Log.getRow.length;
int CELLCOUNTER = CellRange.length;

Cell OutputCell = Log.getCell(Y, 1);
OutputCell.getType();

if (OutputCell.getType() == CellType.LABEL) {
    String S = OutputCell.getContents();
    System.out.println("Retrieved: "+S);
    }
if (Y == 14 && CELLCOUNTER != 0 || Y == cellCount){
    Y = 0;
    ROWCOUNTER++;
    }
}
}


#2

@brendan0222,
IMHO
you would be better served by
either google search over the site stackoverflow,com with its millions of programmer-users
like
JExcelAPI moving to next row site:stackoverflow.com
for instance
http://stackoverflow.com/questions/8217438/java-excel-api-how-to-determine-last-row-when-reading-a-spreadsheet