string ExcelName ="xxx"
string path = Application.StartupPath +"//"+ExcelName + ".xlsx";//获取表的地址 if (!File.Exists(path)) { MessageBox.Show(ExcelName+"表没有找到"); return; } using (ExcelPackage Excel = new ExcelPackage(new FileStream(path, FileMode.Open)))//打开表 { ExcelWorksheet sheet = ExcelBuff.Workbook.Worksheets[1]; for (int startRow= sheet.Dimension.Start.Row, endRow = sheet.Dimension.End.Row; startRow <= endRow; startRow++) { }
}
原文:https://www.cnblogs.com/Rwans/p/14260639.html