1. 需要下载jxl.jar包
自己研究了一下,代码如下
package file;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.write.*;
import jxl.Sheet;
import jxl.Cell;
import jxl.Workbook;
public class excel {
/**
* @param args
* @throws IOException
* @throws BiffException
*/
public static void main(String[] args) throws BiffException, IOException {
// TODO Auto-generated method stub
Workbook book = Workbook.getWorkbook(new File("F://Center20130902update.xls"));
Sheet sheet=book.getSheet(0);
ArrayList list = new ArrayList();
for(int k=2;k<96;k++){
Map rowData = new HashMap();
for(int j=2;j<5;j++){
Cell cell = sheet.getCell(j,k);//列,行
Cell keycell = sheet.getCell(j,1);
String key = keycell.getContents();
String Content = cell.getContents();
rowData.put(key, Content);
}
list.add(rowData);
}
System.out.println(list);
book.close();
}
}