读取Excel中内容

public static void main(String[] args) throws Exception{
redExcel();

private static void redExcel() throws Exception{
File file = new File("F://a.xls");
InputStream is = new FileInputStream(file);
jxl.Workbook rwb = Workbook.getWorkbook(is);
//Excel中sheet的个数int sheets = rwb.getNumberOfSheets();

Sheet st = rwb.getSheet(0);
jxl.Cell c00 = st.getCell(0,0);
String strc00 = c00.getContents();
//获取得一行第二列的值
jxl.Cell c10 = st.getCell(1,0);
String strc10 = c10.getContents();
//获取第二行第二列的值
jxl.Cell c11 = st.getCell(1,1);
String strc11 = c11.getContents();
System.out.println(strc00);
System.out.println(strc10);
System.out.println(strc11);
}

你可能感兴趣的:(读取Excel中内容)