jxl读取excel
import java.io.File; import java.io.IOException; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; /** * @author 刘毅 * @date 2010-2-25 * @ClassName JxlForReaderExcel.java * @Email liu_yi126@163.com * @param 读取excel * @param */ public class JxlReaderForExcel { public static void readerExcel() { Workbook wb; try { wb = Workbook.getWorkbook(new File("src/out.xls")); Sheet s = wb.getSheet(0);// 第1个sheet Cell c; int row = s.getRows();// 总行数 int col = s.getColumns();// 总列数 for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { c = s.getCell(j,i); System.out.print(c.getContents() + " "); } //换行 System.out.println(); } } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) { JxlReaderForExcel.readerExcel(); } }