Excel export has headings but no data

16 posts, 0 answers
  1. Allison
    Allison avatar
    2 posts
    Member since:
    Aug 2015

    Posted 11 Aug 2015 Link to this post

    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!​​

  2. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 13 Aug 2015 Link to this post

    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!
     
  3. Allison
    Allison avatar
    2 posts
    Member since:
    Aug 2015

    Posted 14 Aug 2015 Link to this post

    Very strange - I'd swear I had the newest versions of everything.  I'll double check and/or start over and see.  Thanks!
  4. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 18 Aug 2015 Link to this post

    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!
     
  5. Aaron
    Aaron avatar
    14 posts
    Member since:
    May 2015

    Posted 21 Sep 2015 Link to this post

    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.

  6. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 23 Sep 2015 Link to this post

    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!
     
  7. Aaron
    Aaron avatar
    14 posts
    Member since:
    May 2015

    Posted 29 Sep 2015 Link to this post

    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?
  8. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 01 Oct 2015 Link to this post

    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!
     
  9. Peter
    Peter avatar
    14 posts
    Member since:
    Dec 2013

    Posted 25 Aug 2017 Link to this post

    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?
  10. Ryan
    Ryan avatar
    3 posts
    Member since:
    Sep 2017

    Posted 11 Apr 2019 Link to this post

    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.

  11. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2499 posts

    Posted 12 Apr 2019 Link to this post

    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.
  12. Ryan
    Ryan avatar
    3 posts
    Member since:
    Sep 2017

    Posted 14 Apr 2019 in reply to Viktor Tachev Link to this post

    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

  13. Ryan
    Ryan avatar
    3 posts
    Member since:
    Sep 2017

    Posted 14 Apr 2019 in reply to Viktor Tachev Link to this post

    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

  14. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2499 posts

    Posted 16 Apr 2019 Link to this post

    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.
  15. Ali
    Ali avatar
    1 posts
    Member since:
    Oct 2018

    Posted 01 Jul 2020 in reply to Viktor Tachev Link to this post

    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

  16. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 03 Jul 2020 Link to this post

    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.
Back to Top