//根据路径通过已存在的excel来创建HSSFWorkbook,即整个excel文档
FileStream file = new FileStream("C:\test.xls", FileMode.Open, FileAccess.Read);
HSSFWorkbook workbook = new HSSFWorkbook(file);
//获取excel的指定sheet"Rawdata"
Sheet sheet = workbook.GetSheet("Rawdata");
DataTable table = new DataTable();
//获取sheet的首行
Row headerRow = sheet.GetRow(0);
//最后一个方格的编号 即总的列数
int cellCount = headerRow.LastCellNum;
//最后一行的标号 即总的行数
int rowCount = sheet.LastRowNum;