}
package impl;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class GetExcelData {
public String getExcelData(int sheet,int row,int cell) throws IOException{
InputStream myxls = new FileInputStream("c:\\workbook.xls"); //输入excel表格
HSSFWorkbook wb = new HSSFWorkbook(myxls); //新建一个表格
HSSFSheet sheetdata = wb.getSheetAt(sheet); //得到第一个sheet
HSSFRow rowdata = sheetdata.getRow(row); //得到第一个row
HSSFCell celldata = rowdata.getCell(cell); //得到第一个row的单元格
return celldata.getStringCellValue(); //活的单元格里面的内容
}
}