I've created a small grid from a remote data source, and it displays fine. Now I'm trying to add Excel and PDF exports. The PDF export works fine, but the Excel one only exports the column headings, no data. I've tried it with the toolbar buttons or the saveAsExcel function and gotten the same result.
I followed these two pages in particular:
http://demos.telerik.com/kendo-ui/grid/excel-export
http://telerikhelper.net/2014/12/30/simple-export-to-excel-from-your-data-grid-using-kendo-ui/
The process seems quite straightforward, so I'm not sure what I could be missing. Any ideas? Thank you!
15 Answers, 1 is accepted
We had such an issue with older version of Kendo UI which was caused by setting the Grid dataSource with its data() method. However, this bug is already fixed and if you are using the latest version in your project as pointed in the Ticket info you should not encounter it.
Regards,
Pavlina
Telerik

Let us know in case you still encounter the issue with the latest version.
Regards,
Pavlina
Telerik

After reading this post I've updated the kendo UI version I'm using to 2015.2.814 and am still having the problem of an empty Excel file after export. The export works if I have a small number of exported rows, but stops working when the export is larger then a few hundred results. I'm guess it stops working somewhere around 1000.
Could you please configure the problematic code in a Dojo example (dojo.telerik.com) and send it to us? Thus we will manage to replicate the exact problem you encounter and advise you accordingly.
Regards,
Pavlina
Telerik

I tried to replicate the problem in this example where more that 731 records are exported to excel, however everything is working without problems. Give it a try and let me know what is the difference in your case.
http://dojo.telerik.com/oQOyu/10
Regards,
Pavlina
Telerik


I am seeing the same thing, I just tried, with the latest 2019 release and Excel export fails to export data with a Remote Data Source (headers are there just no data).
PDF export is ok and all other local data sources export fine.
Would you open the browser developer tools (F12) and check if there is an error in the console when exporting the data? In case there is an error that can point us in the right direction.
With that said, please send us a dojo sample or a runnable project where the behavior is replicated. This will enable us to examine the issue locally.
Regards,
Viktor Tachev
Progress Telerik

Hi Viktor,
I did manage to replicate the issue. In a nutshell, I prevent the the schema transport from loading on the first attempt and then later call the datasource.fetch method. Shortly after the grid is created, the grid is configured from some persisted settings, then the data is loaded. This prevents the grid from loading data multiple times as the config is changed.
You can see the active flag below controls this on the grid datasource.
var options = {
transport: {
active: false, // The Grid will update this setting after the grid configuration is complete. This prevents the grid datasource from loading multiple times during initialisation when various settings change.
read: function(options) {
var data = "";
if (this.parameterMap) {
var ops = (options && options.data) ? options.data : "";
data = this.parameterMap(ops);
}
if (this.active) {
$.ajax({
url: dsRef.getReadUrl(),
data: data,
dataType: "json",
success: function(result) {
// notify the data source that the request succeeded
options.success(result);
},
error: function(result) {
// notify the data source that the request failed
options.error(result);
}
});
}else {
options.success([]);
}
}
},
schema: {
model: this.getModel()
}
};
$.extend(defaultOptions, options);
this.postConfigure(defaultOptions);
return new kendo.data.DataSource(defaultOptions);
If the active flag is changed to default to true the export works fine. Unless I am doing something wrong in the custom transport I think this might be a bug? Note: this only affects grids with serverPaging set to true. Grids with serverPaging=false work fine.
I will prep a dojo
Thanks
Ryan

Hi Viktor,
Examples to illustrate the issue.
1. Dojo1: https://dojo.telerik.com/eMIfilIb/2 -> no data in excel.
Then edit 'Active = true' -> Data exports in excel file.
2. Dojo2: https://dojo.telerik.com/igaQibOd -> ServerPaging = false. Data exports fine
Note: The server paging is not properly setup, just using the first remote data source I could find, but it still illustrates the issue.
Thanks
Ryan
With server operations enabled the Grid will make a request to the remote service to request the data when exporting to Excel. If server paging is not enabled no such request is made since the items are available client-side.
That said, if you would like to prevent the Grid from requesting data initially I would suggest utilizing the autoBind option. When you need to retrieve the records call the DataSource read() method. The updated dojo below illustrates the approach:
Regards,
Viktor Tachev
Progress Telerik

Hi Viktor,
I have implemented copying data from excel file to Kendo Grid. Inorder to compose data i need excel template.
How can I download excel file with header info as export to excel. Initially the grid will be empty he will download as excel with header and compose the data and copies to the Grid.
Regards,
Abbas Syed
Hello, Ali,
The built-in excel export uses a kendo.ooxml.Workbook so you can alter that as you need to during the excel export event.
We have an example that shows how to insert custom headers in the grid excel export:
https://docs.telerik.com/kendo-ui/knowledge-base/grid-excel-export-custom-headers
Kind
Regards,
Alex Hajigeorgieva
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.