POI is an Apache open source jar package that can be found by searching the Java POI and downloading the development package.
Features that are included:
Can read excel2003,2007,2010 and so on.
To read the excel2007/2010 code:
Public Static Booleanisnumeric (String str) { for(inti = 0; I < str.length (); i++) { if(!Character.isdigit (Str.charat (i))) { return false; } } return true;} Public StaticList<list<string>> readxlsx (String path)throwsException {InputStream is=NewFileInputStream (path); @SuppressWarnings ("Resource") Xssfworkbook Xssfworkbook=NewXssfworkbook (IS); List<List<String>> result =NewArraylist<>(); for(intSheetix = 0; Sheetix < Xssfworkbook.getnumberofsheets (); sheetix++) {Xssfsheet Xssfsheet=Xssfworkbook.getsheetat (Sheetix); if(Xssfsheet = =NULL) Continue; for(intRowNum = 1; RowNum <= xssfsheet.getlastrownum (); rownum++) {Xssfrow Xssfrow=Xssfsheet.getrow (RowNum); intMincolix =Xssfrow.getfirstcellnum (); intMaxcolix =Xssfrow.getlastcellnum (); List<String> rowlist =NewArraylist<>(); for(intColix = Mincolix; Colix < Maxcolix; colix++) {Xssfcell cell=Xssfrow.getcell (Colix); if(Cell = =NULL) Continue; Rowlist.add (Cell.tostring ()); } result.add (Rowlist); } } returnresult;}
JAVA: Reading Excel from POI