apache poi - Read from a specific row onwards from Excel File -


i have got excel file having around 7000 rows approx read. , excel file contains table of contents , actual contents data in details below.

i avoid rows table of content , start actual content data read. because if need read data "cpu_info" loop , search string occurrence twice 1] table of content , 2] actual content.

so know if there way can point start row index start reading data content excel file , skipping whole of table of content section?

as taken apache poi documentation on iterating on rows , cells:

in cases, when iterating, need full control on how missing or blank rows or cells treated, , need ensure visit every cell , not defined in file. (the celliterator return cells defined in file, largely values or stylings, depends on excel).

in cases such these, should fetch first , last column information row, call getcell(int, missingcellpolicy) fetch cell. use missingcellpolicy control how blank or null cells handled.

if take example code documentation, , tweak requirement start on row 7000, , assuming want not go past 15k rows, get:

// decide rows process int rowstart = math.min(7000, sheet.getfirstrownum()); int rowend = math.max(1500, sheet.getlastrownum());  (int rownum = rowstart; rownum < rowend; rownum++) {    row r = sheet.getrow(rownum);     int lastcolumn = math.max(r.getlastcellnum(), my_minimum_column_count);     (int cn = 0; cn < lastcolumn; cn++) {       cell c = r.getcell(cn, row.return_blank_as_null);       if (c == null) {          // spreadsheet empty in cell       } else {          // useful cell's contents       }    } } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -