Apache POI解析Excelファイル
3152 ワード
公式サイト:http://poi.apache.org/
コアファイル:
maven座標方式に基づいてPOI:
ユニットテストコードを導入:





/**
* POI Excel
* @throws IOException
* @throws FileNotFoundException
*/
@Test
public void test1() throws FileNotFoundException, IOException{
String filePath="F:\\java\\ .xls";//
HSSFWorkbook workbook=new HSSFWorkbook(new FileInputStream(new File(filePath)));
//
HSSFSheet worksheet = workbook.getSheetAt(0);
//
for (Row row : worksheet) {
int rowNum = row.getRowNum();
if(rowNum == 0){
//
continue;
}
for (Cell cell : row) {
//
String value = cell.getStringCellValue();
System.out.print(value + " ");
}
System.out.println();
}
}