: A script creates a hidden tag with the data as a URL and programmatically clicks it to trigger the download. Saving to Local Disk (Desktop Applications)

: For .xlsx files, use application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .

public IActionResult DownloadExcel() { byte[] fileContents; // Your byte array logic here string fileName = "Report.xlsx"; string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; // Return the byte array as a downloadable file return File(fileContents, contentType, fileName); } Use code with caution. Downloading in Blazor