> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doconda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I add an Excel editor or viewer to a React app?

> Render DocondaEditor with an .xlsx: users edit cells, formulas and formatting in the browser, or only view the workbook with readOnly.

Render Doconda's editor plugin (`@doconda/editor`) and pass the `.xlsx` in `src`. Users change cells, formulas and
formatting inside your site, formulas are calculated in the editor, and with `readOnly` they only view the workbook.
The file is edited in the browser, not uploaded anywhere.

## Steps

1. Get the plugin in the dashboard (**Editor**), with a 7-day free trial. See
   [Licence and domains](https://docs.doconda.com/editor/license.md).
2. Install it with the command the dashboard gives you. It needs React 19 or later:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
# .npmrc with the registry and token from the dashboard (Editor)
npm install @doconda/editor
```

3. Render the editor in a container with a height and pass it the `.xlsx` link:

```tsx theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import { DocondaEditor } from "@doconda/editor"

export function Edit({ url }: { url: string }) {
  return (
    <div style={{ height: 700, display: "flex" }}>
      <DocondaEditor src={url} licenseKey="ek_eu_…" className="flex-1" />
    </div>
  )
}
```

4. Get the file when the user saves (Ctrl/Cmd+S or **File** → **Save**):

```tsx theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
<DocondaEditor src={url} licenseKey="ek_eu_…" onSave={(bytes) => upload(bytes)} />
```

The format comes from the link's extension. If it has none, pass `format="cell"`.

## What it does in an Excel file

* **Cells and formulas**, calculated in the editor. `engineLocale` (`"es-ES"`, `"en-US"`…) sets how they're written:
  `SUMA` or `SUM`, decimal comma or point.
* **Formatting**: fonts, fill, borders, number formats, merge and wrap text.
* **Structure**: insert and delete rows and columns, change widths and heights, freeze panes, and work with several
  sheets.
* **Data**: sort, filter, charts and comments.

Whatever the editor doesn't touch is saved as is: parts of the file it can't edit are kept.

## View only

```tsx theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
<DocondaEditor src={url} licenseKey="ek_eu_…" readOnly />
```

The toolbar disappears and nothing can be edited; users can still select and copy, and move between sheets.

## Choose the buttons

The Excel toolbar has its own button IDs. `toolbar` picks which appear and in what order, and `|` separates groups:

```tsx theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
<DocondaEditor src={url} licenseKey="ek_eu_…" toolbar="undo redo | bold italic | fill borders | numberFormat decimalsDown decimalsUp" />
```

Some Excel IDs: `undo` `redo` `font` `size` `bold` `italic` `underline` `strike` `color` `fill` `borders`
`alignLeft` `alignCenter` `alignRight` `wrap` `merge` `numberFormat` `currency` `percent` `decimalsDown` `decimalsUp`
`insertCells` `deleteCells` `autosum` `sort` `filter` `chart` `comment` `freeze`. The default toolbar is exported as
`CELL_TOOLBAR`. See [Customize: toolbar](https://docs.doconda.com/editor/customize.md#toolbar).

## FAQ

> [accordion] Are formulas kept when saving?
>
> Yes. Formulas are saved in the `.xlsx` as formulas, not as fixed values.

> [accordion] Can I open an Excel file the user uploaded?
>
> Yes. Pass it in `file` (for example, the `File` from an `<input type="file">`) instead of `src`, with its name in
> `fileName`.

> [accordion] What about Word and PowerPoint?
>
> The same component opens `.docx` and `.pptx`. See [Word editor for React](https://docs.doconda.com/answers/docx-editor-react.md) and
> [PowerPoint viewer for React](https://docs.doconda.com/answers/powerpoint-viewer-react.md).

> [accordion] Can I use my brand colours?
>
> Yes, with `theme` for the editor and `colors` for the palette users pick from. Cells keep the file's own colours.
> See [Customize](https://docs.doconda.com/editor/customize.md).

## Related

* [Editor plugin](https://docs.doconda.com/editor/introduction.md): every prop, event and method.
* [How do I edit an Excel file with AI and keep its formulas?](https://docs.doconda.com/answers/edit-excel-keep-formulas.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.