读取EXCEL
package com.wxgs.ch04;
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ExcelTest {
static String getExcel(String bb){
String a="";
try {
Workbook book=Workbook.getWorkbook(new File(bb));
//获得第一个工作对象
Sheet sheet=book.getSheet(0);
//得到第一列
Cell cell1=sheet.getCell(0,0);
a=cell1.getContents();
} catch (BiffException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return a;
}
public static void main(String[] args) {
String a=getExcel("d:/a.xls");
System.out.println(a);
}
}