java - Getting data between a date range -
i'm writing program in java there excel sheet 3 users .
user1 user2 uesr3
and task process products daily, , data stored in excel below.
user | product | date user1 | 123 | 2/22/2016 user2 | 143 | 2/22/2016 user2 | 145 | 2/22/2016 user3 | 182 | 2/24/2016 user2 | 151 | 2/25/2016
and in java application, when select data range, need print number of users worked on number of products in console.
like if select date range 2/22/2016
-'2/22/2016'. should show me
user1 - 1 user2 - 2
this sample created, in real there around 1000 rows , counter slowdown process.
i'm sure can done in jdbc, don't want use jdbc application, can please let me know if can done using poi? if so, please give me reference.
i'm using below code read excel.
string excelfilepath = "books.xlsx"; fileinputstream inputstream = new fileinputstream(new file(excelfilepath)); workbook workbook = new xssfworkbook(inputstream); sheet firstsheet = workbook.getsheetat(0); iterator<row> iterator = firstsheet.iterator(); while (iterator.hasnext()) { row nextrow = iterator.next(); iterator<cell> celliterator = nextrow.celliterator(); while (celliterator.hasnext()) { cell cell = celliterator.next(); switch (cell.getcelltype()) { case cell.cell_type_string: system.out.print(cell.getstringcellvalue()); break; case cell.cell_type_boolean: system.out.print(cell.getbooleancellvalue()); break; case cell.cell_type_numeric: system.out.print(cell.getnumericcellvalue()); break; } system.out.print(" - "); } system.out.println(); } workbook.close(); inputstream.close();
thanks
Comments
Post a Comment