excelExport

Fires when the user clicks the Export to Excel toolbar button.

Event Data

e.sender kendo.ui.Spreadsheet

The widget instance which fired the event.

e.data Array

The array of data items that is used to create the Excel workbook.

e.workbook kendo.ooxml.Workbook

The Excel workbook configuration object. Used to initialize a kendo.ooxml.Workbook class. Modifications of the workbook will reflect in the output Excel document.

e.preventDefault Function

If invoked, the Spreadsheet will not save the generated file.

Example - subscribing to the excelExport event during initialization

<div id="spreadsheet"></div>
<script>
    $("#spreadsheet").kendoSpreadsheet({
        sheets: [{
            name: "Food Order",
            mergedCells: [
                "A1:G1"
            ],
            rows: [{
                height: 70,
                cells: [{
                    value: "My Company", fontSize: 32, textAlign: "center"
                }]
            }],
        }],
        excelExport: function(e) {
        e.workbook.fileName = "Spreadsheet1.xlsx";
        }
    });

    var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
    spreadsheet.saveAsExcel();
</script>

Example - subscribing to the excelExport event after initialization

<div id="spreadsheet"></div>
<script>
    $("#spreadsheet").kendoSpreadsheet({
        sheets: [{
            name: "Food Order",
            mergedCells: [
                "A1:G1"
            ],
            rows: [{
                height: 70,
                cells: [{
                    value: "My Company", fontSize: 32, textAlign: "center"
                }]
            }],
        }]
    });

    var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
    spreadsheet.bind("excelExport", function(e) {
        e.workbook.fileName = "Spreadsheet1.xlsx";
    });

    spreadsheet.saveAsExcel();
</script>
In this article
Not finding the help you need? Improve this article