This is a migrated thread and some comments may be shown as answers.

Grid Excel Export just fails ona large number of rows

1 Answer 721 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 11 Apr 2019, 11:02 AM

Hi there,

I have a grid with an Excel Export option. here's how I decorate the Grid component.

                              .Excel(excel => excel
                                    .AllPages()
                                    .FileName(@excelFilename)
                                    .Filterable(true)
                                    .ProxyURL(Url.Action("ExcelExportSave", "Search"))
                                    .ForceProxy()
                                )

And then, in the controller I do this:

        [HttpPost]

        public ActionResult ExcelExportSave(string contentType, string base64, string fileName)
        {
            var fileContents = Convert.FromBase64String(base64);

            return File(fileContents, contentType, fileName);
        }

However, some of the queries return over a million rows. This causes the download to stall.Is there any way to export CSV or maybe just stream the contents down in chunks?

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 16 Apr 2019, 08:07 AM
Hello Jason,

The default Excel export happens on the client, even if you have a server-side proxy to save the exported content to Excel. The maximum size of the exported file has a system-specific limit, depending on the client computer. 

In such scenarios, it is best to do the export server-side. The UI for ASP.NET MVC suite supports server-side Excel export, as demonstrated in this demo:
Grid / Server Export

You can read more about it here:
Use Server-Side Processing 

and see a demo of exporting large amounts of data here:
SpreadStreamProcessing / Large Document Export


However, .NET Core (version < 3.0) does not support all the needed APIs for this library to work, so UI for ASP.NET Core does not yet support server-side document processing. There is a feedback item for the Document Processing Library, where the status of it support for .NET core is discussed:
Document Processing: Provide version for .NET Core

If upgrading to .NET 3.0 is in your plans, you can follow the instructions from the discussion and try using the beta version of the .NET Core document processing library.

If you can't upgrade, I can only suggest cutting down on the amount of data exported at once, so it can be handled in the browser.

Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or