exportSelectedToExcel

Exports the selected items to an Excel file.

Parameters

includeHeaders Boolean

If set to true, the exported items will include the column headers.

Example

 <div id="grid"></div>
 <a class="k-button" onclick="selectAndExport()">Select and export</a>
 <script>
        $("#grid").kendoGrid({
            columns: [
                { field: "productName" },
                { field: "category" }
            ],
            dataSource: {
                data: [
                { productName: "Tea", category: "Beverages" },
                { productName: "Coffee", category: "Beverages" },
                { productName: "Ham", category: "Food" },
                { productName: "Bread", category: "Food" }
                ]
            },
            selectable: "multiple, cell"
        });

    function selectAndExport() {
        var grid = $("#grid").data("kendoGrid");
        grid.select($('#grid tbody td').slice(0,2).add($('#grid tbody td').slice(4,6)));

        grid.exportSelectedToExcel(true);
    }

 </script>
In this article