Excel Export
The PivotGrid enables you to export its content to Excel.
By default, the Excel export is enabled when kendo.ooxml.min.js
is loaded on the page. kendo.ooxml.min.js
is included in kendo.all.min.js
and kendo.web.min.js
.
To initiate Excel export by using code, call the saveAsExcel
method.
For more information, refer to the following resources:
Exporting the Content
By default, the PivotGrid exports the current data with the applied sorting and filtering functionalities. The PivotGrid does not export the current CSS theme in the Excel file. For more information on changing the visual appearance of the Excel document, refer to the following section on customization.
The dataCellTemplate
, columnHeaderTemplate
, and the rowHeaderTemplate
options are not used during the export to Excel. For more information, refer to the following section on templates.
Customizing the Appearance
excelExport
allows the customization of the generated Excel document. The workbook event argument exposes the generated Excel workbook configuration. For more information on how the Excel documents work, refer to the article on Excel export in Kendo UI for jQuery.
Using Templates
The PivotGrid does not use dataCellTemplate
, columnHeaderTemplate
, and rowHeaderTemplate
during Excel export and exports only its data because the templates may contain arbitrary HTML which cannot be converted to Excel column values.
Troubleshooting
A "JSZip Is Not Found" JavaScript error is thrown
If the JSZip JavaScript library is not found, an exception is thrown when you click the Export to Excel button or call saveAsExcel
. To work around this issue, include JSZip in the page. For more information, refer to the introductory topic on exporting to Excel.
Excel Export is not working in Internet Explorer and Safari
Internet Explorer 10 and earlier and Safari do not support file saving. These browsers require the implementation of a server proxy. To specify the URL of the server proxy, set the proxyURL
option.
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
toolbar: ["excel"],
excel: {
fileName: "Kendo UI Grid Export.xlsx",
proxyURL: "/proxy"
},
dataSource: {
type: "odata",
transport: {
read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Products"
},
pageSize: 7
},
sortable: true,
pageable: true,
columns: [
{ width: 300, field: "ProductName", title: "Product Name" },
{ field: "UnitsOnOrder", title: "Units On Order" },
{ field: "UnitsInStock", title: "Units In Stock" }
]
});
</script>