title: Download the returned Excel file in the frontend
body: <p>I have an issue with finding the proper jQuery or JavaScript code to allow users to download an excel file that was generated in the C# API controller, tried many different ways and none of them worked, My backend code: (used ClosedXML.Excel package)</p>
  <pre><code>public ApiResponse DownloadAllMembersFile(IEnumerable&lt;IMember&gt; members)
  {
  
  
      using (var workbook = new XLWorkbook())
      {
          var worksheet = workbook.Worksheets.Add(&quot;AllMembers&quot;);
          var currentRow = 1;
  
          #region Header
          worksheet.Cell(currentRow, 1).Value = &quot;StudentId&quot;;
          worksheet.Cell(currentRow, 2).Value = &quot;Name&quot;;
          worksheet.Cell(currentRow, 3).Value = &quot;Email&quot;;
          #endregion
  
          #region Body
          foreach (var member in members)
          {
              currentRow++;
              worksheet.Cell(currentRow, 1).Value = member.Id;
              worksheet.Cell(currentRow, 2).Value = member.Name;
              worksheet.Cell(currentRow, 3).Value = member.Email;
          }
          #endregion
  
          using (var stream = new MemoryStream())
          {
              workbook.SaveAs(stream);
              var content = stream.ToArray();
              return new ApiResponse( true,&quot;done&quot;,File(
                  content,
                  &quot;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;,
                  &quot;AllMembers.xlsx&quot;
                  ));
  
          }
  
      }
  }
  </code></pre>