Apache POI is an open Source Library of the Apache Software Foundation , where POI provides APIs to Java program Read and write functionality for Microsoft Office format archives.
Download the development package:
Unzip the zip file above:
introducing in the project POI dependencies:
<Dependency> <groupId>Org.apache.poi</groupId> <Artifactid>Poi</Artifactid> <version>3.11</version></Dependency>
POI use:
@Test Public voidTest1 ()throwsFileNotFoundException, ioexception{String filePath= "C:\\users\\zhaoqx\\desktop\\bos project (Dark Horse phase 32) \\BOS-day05\\ data \ Zone Import test data. xls"; //wrapping an Excel file ObjectHssfworkbook Workbook =NewHssfworkbook (NewFileInputStream (NewFile (FilePath)); //read the first sheet tab in a fileHssfsheet hssfsheet = workbook.getsheetat (0); //traverse all rows in a tab page for(Row row:hssfsheet) {System.out.println (); for(Cell cell:row) {String value=Cell.getstringcellvalue (); System.out.print (Value+ " "); } } }
The use of Apache POI technology