JExcelAPI / Excel For Loop


<Below this line, add a link to the EXACT exercise that you are stuck at.>
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.

<In what way does your code behave incorrectly? Include ALL error messages.>

``` 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);

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

<do not remove the three backticks above>

you would be better served by
either google search over the site stackoverflow,com with its millions of programmer-users
JExcelAPI moving to next row
for instance