5.20231.904
5.20231.904

Import from Excel

# FlexSheet Import and Export Excel Files You can import existing Excel files into FlexSheet or export FlexSheet to a new Excel file.

FlexSheet has load and save methods for each of these functions.

import * as wjFlexSheet from '@grapecity/wijmo.grid.sheet';

let excelIOSheet = new wjFlexSheet.FlexSheet('#excelIOSheet');

//Import a file from end user
let fileInput = document.querySelector('#importFile');
if (fileInput.files[0]) {
    excelIOSheet.loadAsync(fileInput.files[0]);
}

Export to Excel

//allow custom input for filename
let fileName = document.querySelector('#fileName').value;
if (fileName == null || fileName === '') {
    fileName = 'FlexSheet.xlsx';
}
//export FlexSheet to Excel
excelIOSheet.saveAsync(fileName);