New to Kendo UI for jQuery? Download free 30-day trial

Include Hidden Grid Columns in Exported Excel Files

Environment

Product Progress® Kendo UI® Grid for jQuery
Product Version 2018.2.516

Description

How can I show some of the hidden columns of the Grid in the exported Excel file?

Important

As of Kendo UI R1 2021 the grid columns have an exportable configuration, which if enabled, will include the hidden column in the exported file.

Solution

Use the hideColumn or showColumn methods to change the visibility of the columns before and after the export and utilize the excelExport event.

The following code snippet demonstrates the implementation of the suggested approach.

var exportFlag = false;
$("#grid").data("kendoGrid").bind("excelExport", function (e) {
    if (!exportFlag) {
        e.sender.showColumn(1);
        e.preventDefault();
        exportFlag = true;
        setTimeout(function () {
            e.sender.saveAsExcel();
        });
    } else {
        e.sender.hideColumn(1);
        exportFlag = false;
    }
});

See Also

In this article