Edit this page

Overview of Excel Export

Since Kendo UI 2014 Q3 release Kendo UI has provided Excel generation support. It allows you to create Excel documents in JavaScript and save them on the client machine.

Requirements

JSZip

To take full advantage of the Excel export feature, download the JSZip library and include the file before the Kendo UI JavaScript files, as shown below.

Example
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jszip/2.4.0/jszip.js"></script>
<script src="http://kendo.cdn.telerik.com/2017.3.1018/js/kendo.all.min.js"></script>

JSZip is part of the Kendo UI distribution and is also available via the Kendo UI CDN:

<script src="http://kendo.cdn.telerik.com/2017.3.1018/js/jszip.min.js"></script>

Important

  • If you do not include JSZip in the page, Kendo UI will raise a runtime exception.
  • As of the Kendo UI R3 2017 release, the Excel Export feature supports JSZip 2.* and 3.* versions. Kendo UI releases prior to R2 2017 SP1 provided Excel export of JSZip 2.* versions only.

Compatibility with Other Libraries

GlobalizeJS

If you want to use GlobalizeJS in your project, include it after the Kendo UI scripts.

RequireJS

JSZip requires some extra initialization code to work with RequireJS.

For detailed information on using RequireJS with the Kendo UI Excel export functionality, refer to the related article.

Browser Support

Excel generation is available for all supported browsers. Saving the file needs a server-side proxy for older browser versions.

Important

Some mobile browsers will not allow you to save the file though.

For detailed information on how to save files, refer to the article about saving files with Kendo UI.

Excel Document Creation

To create an Excel document (workbook), follow the steps:

Step 1 Instantiate a kendo.ooxml.Workbook. The workbook has an array of sheets. Sheets have rows and rows have cells.

Step 2 Call the toDataURL or toDataURLAsync methods of the workbook to get the output Excel file as a data URI.

Step 3 Call the kendo.saveAs method to save the Excel file on the client machine.

The example below demonstrates how to create an Excel workbook.

Example
<script>
var workbook = new kendo.ooxml.Workbook({
  sheets: [
    {
      // Column settings (width)
      columns: [
        { autoWidth: true },
        { autoWidth: true }
      ],
      // Title of the sheet
      title: "Customers",
      // Rows of the sheet
      rows: [
        // First row (header)
        {
          cells: [
            // First cell
            { value: "Company Name" },
            // Second cell
            { value: "Contact" }
          ]
        },
        // Second row (data)
        {
          cells: [
            { value: "Around the Horn" },
            { value: "Thomas Hardy" }
          ]
        },
        // Third row (data)
        {
          cells: [
            { value: "B's Beverages" },
            { value: "Victoria Ashworth" }
          ]
        }
      ]
    }
  ]
});
kendo.saveAs({
    dataURI: workbook.toDataURL(),
    fileName: "Test.xlsx"
});
</script>

See Also

Articles on the Excel export functionality in Kendo UI:

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy