EXAMPLES
Excel Import
createExcelImportPlugin() provides optional .xlsx import, parsed in the browser to replace the current workbook.
Excel Import Plugin
Excel import is a separate optional plugin; the main package excludes the parser. Files are read locally in your browser. A successful import replaces all worksheets in this example.
Imports .xlsx data, formulas, common styles, merges, and row and column sizes. Legacy .xls, encrypted files, images, charts, and data validation rules are not imported.
The sample contains six worksheets: Values, Number formats, Formulas, Styles, Layout, and Hidden sheet. It covers text, numbers, booleans, dates, errors, shared formulas, fonts, borders, merged cells, frozen panes, and hidden rows and columns. Hyperlinks and rich text retain their display text. Hidden worksheets become visible tabs after import.
Import an .xlsx File
Download the sample file, then click Import Excel in the toolbar. Confirm replacement of the current workbook before importing.
import { createWorkbook } from 'cyexcel';
import { createExcelImportPlugin } from 'cyexcel-plugin-excel-import';
const excelImport = createExcelImportPlugin();
const workbook = createWorkbook(container, {
toolbar: { items: excelImport.toolbarItems }
});
excelImport.attach(workbook);
// On unmount:
excelImport.dispose();
workbook.dispose();