# Excel Export

The KendoReact TreeList provides options for exporting its data to Excel in hierarchical tree format.

## Getting Started

To enable the Excel export:

1. Install `kendo-react-excel-export` package.

   ```sh
   npm i @progress/kendo-react-excel-export @progress/kendo-licensing
   ```

2. Import the ExcelExport component in your React Application.

   ```jsx
   import { ExcelExport } from '@progress/kendo-react-excel-export';
   ```

3. Wrap the TreeList inside an ExcelExport component.

4. Set the [hierarchy](https://www.telerik.com/kendo-react-ui/components/excelexport/api/excelexportprops#hierarchy) prop of the ExcelExport to true.

5. Transform the data to a flat array with a level for each data record, using the [treeToFlat](https://www.telerik.com/kendo-react-ui/components/treelist/api/treetoflat) function provided by the TreeList package.

6. Pass the flat array and columns that have to be exported to the [`save`](https://www.telerik.com/kendo-react-ui/components/excelexport/api/excelexport#save) function.

The following example demonstrates the basic implementation of the Excel export functionality of the TreeList.

[Demo Source](https://demos.telerik.com/kendo-react-ui/treelist/excel/basic/func/source.txt)

## Configuration

You can entirely control the Excel export configuration through the arguments that are passed to the [`save`](https://www.telerik.com/kendo-react-ui/components/excelexport/api/excelexport#save) function of the KendoReact Excel Export component.

The ExcelExport enables you to:

* [Export specific data](https://www.telerik.com/kendo-react-ui/components/treelist/excel-export#exporting-specific-data)
* [Customizing Exported Workbook](https://www.telerik.com/kendo-react-ui/components/treelist/excel-export#customizing-exported-workbook)

### Exporting Specific Data

To export specific data, pass the data to the [`save`](https://www.telerik.com/kendo-react-ui/components/excelexport/api/excelexport#save) function of the ExcelExport component. For example, if the TreeList has its paging enabled but you need to export only the current page, pass the paged data to the `save` function.

[Demo Source](https://demos.telerik.com/kendo-react-ui/treelist/excel/single-page/func/source.txt)

### Customizing Exported Workbook

When exporting the excel file we provide an option to customize the generated workbook. This can be used to modify the values, the appearance or the sheets in the document.
The following example demonstrates how to add a different background color on the alt rows.

[Demo Source](https://demos.telerik.com/kendo-react-ui/treelist/excel/customization/func/source.txt)

## Known Limitations

* During the export to Excel, the TreeList does not use column formats. Column formats are incompatible with Excel. For more information, refer to the page on the [Excel-supported formats](https://support.office.com/en-us/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4?ui=en-US\&rs=en-US\&ad=US).
* The maximum size of the exported file to Excel has a system-specific limit. For large data sets, it is highly recommended that you use a server-side solution.
* When you use the ExcelExport in older browsers, such as Internet Explorer 9 and Safari, you have to implement a server proxy. For more information, refer to the [`proxyUrl`](https://www.telerik.com/kendo-react-ui/components/excelexport/api/excelexportprops#proxyurl) configuration of the ExcelExport component.

## Suggested Links

* [ExcelExport Overview](https://www.telerik.com/kendo-react-ui/components/excelexport)
* [API Reference of the TreeList Component](https://www.telerik.com/kendo-react-ui/components/treelist/api/treelist)
