public FileContentResult ExportToExcel() { var items = languageDictionaryService.GetAllDictionaryItems(); MemoryStream stream = null; var locale = "en"; using (ExcelPackage excel = new ExcelPackage()) { excel.Workbook.Worksheets.Add("Dictionary"); var excelWorksheet = excel.Workbook.Worksheets["Dictionary"]; List <string[]> headerRow = ExportHeadersToList(); string headerRange = "A1:" + Char.ConvertFromUtf32(headerRow[0].Length + 64) + "1"; excelWorksheet.Cells[headerRange].LoadFromArrays(headerRow); excelWorksheet.Cells[2, 1].LoadFromArrays(ExportToList(items, locale)); stream = new MemoryStream(excel.GetAsByteArray()); } return(File(stream.ToArray(), "application/vnd.ms-excel", $"Total-Code-Umbraco-Dictionary-Items-{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}.xlsx")); }