Excel to DataTable using EPPlus - excel locked for editing
I'm using the following code to convert an Excel to a datatable using EPPlus: public DataTable ExcelToDataTable(string path) { var pck = new OfficeOpenXml.ExcelPackage(); pck.Load(File.OpenRead(path)); var ws = pck.Workbook.Worksheets.First(); DataTable tbl = new DataTable(); bool hasHeader = true; foreach (var firstRowCell in ws.Cells[1, 1, 1, ws.Dimension.End.Column]) { tbl.Columns.Add(hasHeader ? firstRowCell.Text : string.Format("Column {0}", firstRowCell.Start.Column)); } var startRow = hasHeader ? 2 : 1; for (var rowNum = startRow; rowNum <= ws.Dimension.End.Row; rowNum++) { var wsRow =