 <p>I haven't been able to reproduce the behavior you describe in a similar application that I have. The only difference is that I'm not loading the byte array into a <code>MemoryStream</code> first, but just passing the byte array to <code>File</code>.</p> <p>So try removing the <code>MemoryStream</code> from the equation. So the code would end up something like: </p> <pre><code>public ActionResult DetailsExcel(string id) { byte[] stream; // changed to byte array using (var excelPackage = new ExcelPackage()) { var ws = excelPackage.Workbook.Worksheets.Add(fileName); ws.Cells["A1"].LoadFromText(csv, this._excelTextFormat); stream = excelPackage.GetAsByteArray(); // removed MemoryStream } return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName + ".xlsx"); } </code></pre>