Are you sure you're getting the NPE in the for loop? If anything, I would expect an NPE way back on Line 4 before you'd get one on Line 10. Is that a complete listing or did you omit some code in between Line 4 and Line 10?
line 4 not returning NPE. Now i found that the excel sheet I'm reading has first 3 rows empty. so it is returning NPE at line 10. How to read the remaining rows?
The JavaDocs say that getRow returns null if the row is not defined. Are you sure that the NPE is thrown on Line 10 and not Line 11? That's where the NPE would be thrown if getRow(i) returns null.
Prasad Rooge wrote:My mistake, getCell() method is returning NPE... well then how I'm i supposed to get further rows even if there is an empty row in the middle.
Am I missing something ? Why don't you just check if row is null before you use it