POI读取Excel2013

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;


		InputStream is = new FileInputStream("C:\\Users\\yuhao\\Desktop\\工作簿1.xlsx");
		XSSFWorkbook xssfWorkbook = new XSSFWorkbook(is);
		XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0); // (0-based physical & logical)
		XSSFRow xssfRow = null;
		Cell cell = null;
		for (int i = 0; i < xssfSheet.getLastRowNum(); i++) {
			xssfRow = xssfSheet.getRow(i); // (0-based)
			cell = xssfRow.getCell(3); // (0 based)
		}


需要引入的jar:
poi-3.13-20150929.jar
poi-ooxml-3.13-20150929.jar
poi-ooxml-schemas-3.13-20150929.jar
xmlbeans-2.3.0.jar

jar下载链接: http://www.apache.org/dyn/closer.lua/poi/release/bin/poi-bin-3.13-20150929.zip

你可能感兴趣的:(java)