New to Kendo UI for AngularStart a free 30-day trial

Opening an Excel File from Blob or Base64 Data in Angular Spreadsheet

Environment

ProductProgress® Kendo UI® for Angular Spreadsheet

Description

I want to open an Excel file from a Blob object or Base64 string data in the Kendo UI for Angular Spreadsheet component. How can I implement this?

Solution

To load an Excel file from a Blob object in the Kendo UI for Angular Spreadsheet component, use the fromFile method of the SpreadsheetWidget and provide the Blob as an argument.

ts
public onImport(spreadsheet: SpreadsheetComponent): void {
    spreadsheet.spreadsheetWidget.fromFile(blob);
}

If the Excel file is represented as a Base64 data, the string must be converted to a Blob object first.

ts
public onImport(spreadsheet: SpreadsheetComponent): void {
    const blob: Blob = base64toBlob(base64String);
    spreadsheet.spreadsheetWidget.fromFile(blob);
}

The base64toBlob is a custom function whose implementation is demonstrated in detail in the Creating a Blob from a base64 string in JavaScript StackOverflow thread.

The following example demonstrates how to open an Excel file from Base64 string data.

Change Theme
Theme
Loading ...
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support