title: How to read excel using EPPlus
body: <p>using .net 4.5 </p>
  
  <p>I'm trying to read .xls/.xlsx file using EPPlus (v4.0.4), but get an error. SO has questions on the same error but none relate or solve my problem.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          GetDataTableFromExcel(@"D:\test.xlsx");
      }
  
  private DataTable GetDataTableFromExcel(string path, bool hasHeader = true)
  {
    using (var pck = new OfficeOpenXml.ExcelPackage())
     {
       using (var stream = File.OpenRead(path))
        {
          pck.Load(stream);
        }
       var ws = pck.Workbook.Worksheets[1];
       DataTable tbl = new DataTable();
       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 (int rowNum = startRow; rowNum &lt;= ws.Dimension.End.Row; rowNum++)
       {
         var wsRow = ws.Cells[rowNum, 1, rowNum, ws.Dimension.End.Column];
         DataRow row = tbl.Rows.Add();
         foreach (var cell in wsRow)
          {
            row[cell.Start.Column - 1] = cell.Text;
          }
       }
     return tbl;
    }
  }
  </code></pre>
  
  <p>The error occurs at <code>pck.Load(stream);</code></p>
  
  <blockquote>
    <p>A disk error occurred during a write operation. (Exception from
    HRESULT: 0x8003001D (STG_E_WRITEFAULT)</p>
  </blockquote>