# File exchange integration

> Add file import and export to your Univer application, with or without collaborative editing.

- Human documentation: [https://docs.univer.ai/server/import-export](https://docs.univer.ai/server/import-export)

- Agent Markdown: [https://docs.univer.ai/server/import-export.md](https://docs.univer.ai/server/import-export.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [import-export/index.mdx](https://github.com/dream-num/documentation/blob/dev/content/server/import-export/index.mdx)

---

To open an Excel file in Univer, first convert it into data the editor can read. To export it, convert the edited data back into an Excel file. The server-side `@univerjs-pro/exchange-node` module handles conversion; the browser uploads files, opens documents, and downloads results.

```mermaid
flowchart LR; A["Excel file"] -->|Server imports| B["Univer document<br/>Edit in the browser"]; B -->|Server exports| C["Excel file"];
```

## Without collaborative editing

For example, a user uploads an Excel file, edits it on the page, and downloads the result as Excel.

1. The browser uploads the file. The server converts it into Univer document data and returns it.
2. The browser opens a spreadsheet with that data, ready for editing.
3. On export, the browser sends the edited data to the server, which generates an Excel file for download.

This does not require a collaboration service. A *snapshot* in the browser APIs is the document data used here. Snapshot import and export still need server-side conversion. To let users save their work and return later, your application also needs to store that data.

See [Office file import and export](https://docs.univer.ai/server/import-export/node.md) for installing and using the conversion module. Start there as well if you only need to process files in Node.js.

## With collaborative editing

For example, a user imports an Excel file, shares the document with colleagues, edits it together with them, and exports it later.

1. The server converts the uploaded file and saves the result as a collaborative document.
2. The server returns a document ID. The browser opens that ID, and other users join the same document using it.
3. On export, the server reads the document's latest content and generates an Excel file for download.

The `unitId` in the browser APIs is this document ID. Complete [Collaboration integration](https://docs.univer.ai/server/collaboration/browser-integration.md) first, then run the [Exchange example](https://docs.univer.ai/server/collaboration/examples.md#exchange). It includes browser, server, and conversion code to follow together.

Wait for current edits to synchronize before exporting, or the file may omit recent changes. See the server-side Office Exchange section of [extension modules](https://docs.univer.ai/server/collaboration/extensions.md) for reading and converting collaborative documents.

## Connect the import and export buttons

Once server-side conversion works, connect it to your page:

* **Using Univer menus or Facade APIs:** follow the [Exchange example](https://docs.univer.ai/server/collaboration/examples.md#exchange) to implement the required upload, conversion, task-query, and download interfaces, then configure the browser plugins. Request addresses and response formats must match.
* **Using your own buttons:** call your application APIs. Open the returned document data or document ID after import, and download the generated file after export.

See [Sheets](https://docs.univer.ai/guides/sheets/features/import-export.md), [Docs](https://docs.univer.ai/guides/docs/features/import-export.md), [Slides](https://docs.univer.ai/guides/slides/features/import-export.md), [Boards](https://docs.univer.ai/guides/boards/features/import-export.md), [Bases](https://docs.univer.ai/guides/bases/features/import-export.md), and [PDFs](https://docs.univer.ai/guides/pdfs/features/import-export.md) for browser configuration. The collaboration example demonstrates Sheets. For other products, check [Office file import and export](https://docs.univer.ai/server/import-export/node.md) and the formats supported by your release.

## Check the integration

Import a real application file, edit it, and export it. Open the result in an Office application and check the edits, formulas, images, and layout. With collaboration, also check that other users can open the same document and that its content survives a server restart.

Before deployment, replace the example's temporary files and in-memory tasks with application storage, limit upload sizes, and handle conversion failures and timeouts. Uploads, task queries, and downloads need access checks; see [identity and authorization](https://docs.univer.ai/server/collaboration/identity-and-authorization.md).
