React Excel Library Overview

    The Infragistics React Excel Library allows you to work with spreadsheet data using familiar Microsoft® Excel® spreadsheet objects like workbook, Worksheet, Cell, Formula and many more. The Infragistics React Excel Library makes it easy for you to represent the data of your application in an Excel spreadsheet as well as transfer data from Excel into your application.

    React Excel Library Example

    Dependencies

    When installing the excel package, the core package must also be installed.

    npm install --save igniteui-react-core
    npm install --save igniteui-react-excel
    

    Component Modules

    The React excel library requires the following modules:

    import { IgrExcelModule } from 'igniteui-react-excel';
    
    IgrExcelModule.register();
    

    Modules Implementation

    The Excel Library contains 5 modules that you can use to limit bundle size of your app:

    • IgxExcelCoreModule – This contains the object model and much of the excel infrastructure
    • IgxExcelFunctionsModule – This contains the majority of the functions for formula evaluations, such as Sum, Average, Min, Max, etc. The absence of this module won’t cause any issues with formula parsing if the formula is to be calculated. For example, if you apply a formula like “=SUM(A1:A5)” and ask for the Value of the cell, then you would get a #NAME! error returned. This is not an exception throw – it’s an object that represents a particular error since formulas can result in errors.
    • IgxExcelXlsModule – This contains the load and save logic for xls (and related) type files – namely the Excel97to2003 related WorkbookFormats.
    • IgxExcelXlsxModule – This contains the load and save logic for xlsx (and related) type files – namely the Excel2007 related and StrictOpenXml WorkbookFormats.
    • IgxExcelModule – This references the other 4 modules and so basically ensures that all the functionality is loaded/available.

    Supported Versions of Microsoft Excel

    The following is a list of the supported versions of Excel.**

    • Microsoft Excel 97

    • Microsoft Excel 2000

    • Microsoft Excel 2002

    • Microsoft Excel 2003

    • Microsoft Excel 2007

    • Microsoft Excel 2010

    • Microsoft Excel 2013

    • Microsoft Excel 2016

    Load and Save Workbooks

    Now that the Excel Library module is imported, next step is to load a workbook.

    In the following code snippet, an external ExcelUtility class is used to save and load a workbook.

    In order to load and save workbook objects, you can utilize the save method of the actual workbook object, as well as its static Load method.

    import { Workbook } from "igniteui-react-excel";
    import { WorkbookSaveOptions } from "igniteui-react-excel";
    import { WorkbookFormat } from "igniteui-react-excel";
    import { ExcelUtility } from "ExcelUtility";
    
    var workbook = ExcelUtility.load(file);
    ExcelUtility.save(workbook, "fileName");
    

    API References