java - Reading Category and Items From excel -
i wanna read category excel file cant read row number because items may vary. using jxl
. can take each cell type im getting type label
every cell
try { workbook workbook = workbook.getworkbook(new file( "path excel file")); sheet sheet = workbook.getsheet(0); int colcount = sheet.getrows(); (int = 0; < colcount; i++) { cell cell = sheet.getcell(0, i); system.out.println(cell.gettype() + " " + cell.getcontents()); } } catch (biffexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); }
i need take category names separately.
as alternative, read column quantity.
the first row contains "category" - retrieve , save (or whatever). retrieve numeric value cell, call sum
. then, continue reading thw cells below. retrieve numeric value , subtract sum
. if sum
reduced 0, increment row, , repeat, unless exceed number of rows.
Comments
Post a Comment