using (OpenFileDialog fd = new OpenFileDialog()) { fd.Filter = "Excel 2007文件(*.xlsx)|*.xlsx|所有文件(*.*)|*.*"; if (fd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { try { using (ExcelPackage pack = new ExcelPackage(new FileInfo(fd.File…
using (ExcelPackage ep = new ExcelPackage(new FileInfo(path))) { ExcelWorksheet ws = ep.Workbook.Worksheets[]; //第1张Sheet 这个用EPPlus 读取excel,代码出错, the given key is not present in the dictionary 原来是因为用wps编辑过的原因. 用Excel重新保存一次就可以了.…
1.创建工程后,需要下载 EPPlus.dll 添加到工程中,这里有一个下载地址:https://download.csdn.net/download/myunity/10784634 2.下面仅实现读取Excel表格的列数据: using System; using System.Collections.Generic; using System.IO; using OfficeOpenXml; namespace ConsoleApplication1 { class Program { s…