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

Excel export has headings but no data

15 Answers 645 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Allison
Top achievements
Rank 1
Allison asked on 11 Aug 2015, 03:53 PM

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

Sort by
0
Pavlina
Telerik team
answered on 13 Aug 2015, 02:05 PM
Hi,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Allison
Top achievements
Rank 1
answered on 14 Aug 2015, 04:27 PM
Very strange - I'd swear I had the newest versions of everything.  I'll double check and/or start over and see.  Thanks!
0
Pavlina
Telerik team
answered on 18 Aug 2015, 09:44 AM
Hi,

Let us know in case you still encounter the issue with the latest version.

Regards,
Pavlina
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Aaron
Top achievements
Rank 1
answered on 21 Sep 2015, 09:21 PM

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.

0
Pavlina
Telerik team
answered on 23 Sep 2015, 06:54 PM
Hello,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Aaron
Top achievements
Rank 1
answered on 29 Sep 2015, 11:54 PM
I've just done a little more testing and found that my Excel Export works with 731 records but not with 865 records. Building a sample in Dojo is fine by me but I need a public data source for it. Do you have any suggestions?
0
Pavlina
Telerik team
answered on 01 Oct 2015, 04:48 PM
Hello,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Peter
Top achievements
Rank 1
answered on 25 Aug 2017, 03:13 PM
Two years later and this is still an issue. When I try to export a grid with 65,000 rows I get an excel spreadsheet with headers but no rows. Is there anything that can be done to fix this?
0
Ryan
Top achievements
Rank 1
answered on 11 Apr 2019, 05:55 AM

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.

0
Viktor Tachev
Telerik team
answered on 12 Apr 2019, 12:52 PM
Hello,

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
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.
0
Ryan
Top achievements
Rank 1
answered on 15 Apr 2019, 12:41 AM

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

0
Ryan
Top achievements
Rank 1
answered on 15 Apr 2019, 02:16 AM

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

0
Viktor Tachev
Telerik team
answered on 17 Apr 2019, 04:29 AM
Hi 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
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.
0
Ali
Top achievements
Rank 1
answered on 02 Jul 2020, 04:26 AM

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

0
Alex Hajigeorgieva
Telerik team
answered on 03 Jul 2020, 02:16 PM

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

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Allison
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Allison
Top achievements
Rank 1
Aaron
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Ryan
Top achievements
Rank 1
Viktor Tachev
Telerik team
Ali
Top achievements
Rank 1
Alex Hajigeorgieva
Telerik team
Share this question
or