# Blazor Spreadsheet Overview

The Spreadsheet for Blazor enables users to view and edit tabular data with an Excel-like user experience. The component supports cell styling, value formatting, links, images, formulas, and a rich collection of mathematical functions.

## Creating Blazor Spreadsheet

To use the Telerik Spreadsheet for Blazor:

1. Add the `TelerikSpreadsheet` tag.
2. (optional) Set the `Data` parameter to a byte array to load an existing Excel file in Open XML (XLSX) format. [Using other formats is also possible](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/overview#spreadsheet-file-format).

> caption Basic Blazor Spreadsheet

<demo metaUrl="client/spreadsheet/overview/example-1/" height="770"></demo>

## Spreadsheet File Format

The Telerik Spreadsheet component loads and exports files in the Open XML SpreadsheetML (XLSX) format. If you want to work with other formats, consider [Telerik Document Processing](https://www.telerik.com/blazor-ui/documentation/integrations/document-processing-libraries). The library includes [different Spreadsheet `FormatProvider`s](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/formats-and-conversion/general-information), which allow you to convert from one format to another. Here are a few possible use cases:

* Convert a [CSV](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/formats-and-conversion/csv/csvformatprovider#import) or [XLS](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/formats-and-conversion/import-and-export-to-excel-file-formats/xls/xlsformatprovider#import) file to [XLSX](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/formats-and-conversion/import-and-export-to-excel-file-formats/xlsx/xlsxformatprovider#export). Use the correct `FormatProvider`, depending on the format that you want to `Import()` to a Telerik [`Workbook`](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-workbooks/working-with-workbooks-what-is-workbook) and `Export()` to an office file format. Then, use the generated XLSX byte array to set the Spreadsheet `Data` parameter.
* Convert an [XLSX file that was exported by the Telerik Spreadsheet](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/overview#spreadsheet-reference-and-methods) to another office document format before saving.
* [Create an XLSX file from `IEnumerable` and pass it to the Spreadsheet](https://www.telerik.com/blazor-ui/documentation/knowledge-base/spreadsheet-bind-to-json-ienumerable-list-collection).
* [Read an exported XLSX file and obtain all cell values](https://www.telerik.com/blazor-ui/documentation/knowledge-base/spreadsheet-get-cell-values).

## Tools

The Spreadsheet provides built-in tools that perform various actions such as:

* Style the cells
* Format the cell values
* Insert images and links
* Merge cells or toggle the visibility of the cell borders.

You can also add custom tools. Learn how to [configure and customize the Blazor Spreadsheet tools](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools).

## Functions and Formulas

The Blazor Spreadsheet component supports formulas and a large variety of Excel functions. See the complete list of available [Spreadsheet functions](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/functions-formulas).

## Events

The [Spreadsheet events](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/events) allow you to implement custom functionality and handle user interactions with the component.

## Spreadsheet Parameters

The table below lists the Spreadsheet parameters. For a full list of the Spreadsheet API members (parameters, methods, and events), check the [Spreadsheet API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikspreadsheet).

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Parameter               | Type and Default Value                                  | Description                                                                                                                                                                                                                                                      |
| ----------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Class`                 | `string`                                                | The custom CSS classes to render for the `<div class="k-spreadsheet">` element. Use the parameter to [override the theme styles](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/override-theme-styles) of some or all Spreadsheet instances. |
| `ColumnHeaderHeight`    | `double` <br /> (`20`)                                  | The pixel height of the column headers that display the letters A, B, C, and so on.                                                                                                                                                                              |
| `ColumnsCount`          | `int`  <br /> (`50`)                                    | The initial number of columns to render. Users can add and delete columns at runtime.                                                                                                                                                                            |
| `ColumnWidth`           | `double` <br /> (`64`)                                  | The initial pixel width of the columns.                                                                                                                                                                                                                          |
| `Data`                  | `byte[]`                                                | The Excel file to display in the Spreadsheet component.                                                                                                                                                                                                          |
| `EnableLoaderContainer` | `bool` <br /> (`true`)                                  | Defines if the component will show a built-in [LoaderContainer](https://www.telerik.com/blazor-ui/documentation/components/loadercontainer/overview) while loading Excel files.                                                                                  |
| `Height`                | `string`                                                | The `height` style of the `<div class="k-spreadsheet">` element. The [built-in themes](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/overview) apply `"600px"` by default.                                                                  |
| `RowHeaderWidth`        | `double` <br /> (`32`)                                  | The pixel width of the row headers that display the row numbers. The default width fits up to 3 digits comfortably.                                                                                                                                              |
| `RowHeight`             | `double` <br /> (`20`)                                  | The initial pixel height of the rows.                                                                                                                                                                                                                            |
| `RowsCount`             | `int` <br /> (`200`)                                    | The initial number of rows to render. Users can add and delete rows at runtime.                                                                                                                                                                                  |
| `Tools`                 | `SpreadsheetToolSet` <br /> (`SpreadsheetToolSets.All`) | The available tabs and tools that users can use to manipulate the Excel file content. The Spreadsheet renders all its tools by default, so the resulting Spreadsheet UI will change in the future.                                                               |
| `Width`                 | `string`                                                | The `width` style of the `<div class="k-spreadsheet">` element. The [built-in CSS themes](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/overview) apply `"100%"` by default.                                                                |

## Spreadsheet Reference and Methods

The Blazor Spreadsheet component exposes methods for programmatic operation. To use them, define a reference to the component instance with the `@ref` directive attribute.

| Method               | Description                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ExportToExcelAsync` | Returns the current Spreadsheet Excel file content as `byte[]`. The application can save the file or pass it to [Telerik Document Processing](https://www.telerik.com/blazor-ui/documentation/integrations/document-processing-libraries) for further manipulation. You can also [get the Spreadsheet cell values](https://www.telerik.com/blazor-ui/documentation/knowledge-base/spreadsheet-get-cell-values) programmatically. |
| `Rebind`             | Refreshes the Spreadsheet and ensures it displays the current `Data`. [`Rebind` is necessary when the Blazor framework cannot re-render components automatically](https://www.telerik.com/blazor-ui/documentation/common-features/data-binding/overview#refresh-data).                                                                                                                                                           |
| `Refresh`            | Calls `StateHasChanged()` for the Spreadsheet component.                                                                                                                                                                                                                                                                                                                                                                         |

> caption Using the Spreadsheet reference and methods

<demo metaUrl="client/spreadsheet/overview/example-2/" height="770"></demo>

## Next Steps

* [Customize the Spreadsheet tools](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools)
* [Learn about the supported Spreadsheet functions and formulas](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/functions-formulas)
* [Handle Spreadsheet events](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/events)

## See Also

* [Live Demo: Spreadsheet](https://demos.telerik.com/blazor-ui/spreadsheet/overview)
* [Spreadsheet API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikspreadsheet)
* [Bind Spreadsheet to IEnumerable](https://www.telerik.com/blazor-ui/documentation/knowledge-base/spreadsheet-bind-to-json-ienumerable-list-collection)
