JjE
JjE

Reputation: 3

how can i save the excel from kendo spreadsheet into a remote server using some thing like

how can i save the excel from kendo spreadsheet into a remote server using some thing like

var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet"); 
spreadsheet.saveAsExcel();

saves excel to client machine.

Upvotes: 0

Views: 1605

Answers (1)

Shai
Shai

Reputation: 3872

You can accomplish this in the excelExport events of the Kendo SpreadSheet.

Use the following code:

excelExport: function(e) {
    // Prevent the default behavior which will prompt the user to save the generated file.
    e.preventDefault();

    // Get the Excel file as a data URL.
    var dataURL = new kendo.ooxml.Workbook(e.workbook).toDataURL();

    // Strip the data URL prologue.
    var base64 = dataURL.split(";base64,")[1];

    // Post the base64 encoded content to the server which can save it.
    $.post("/server/save", {
        base64: base64,
        fileName: "ExcelExport.xlsx"
    });
}

You can read further about this in Kendo's documentation here. This page is for exporting to excel from a Kendo Grid but it's exactly the same for the SpreadSheet.

Upvotes: 0

Related Questions