# File import and export

> Convert Office files into product snapshots, and serialize edited snapshots back to files.

- Human documentation: [https://docs.univer.ai/overview/features/shared/file-conversion](https://docs.univer.ai/overview/features/shared/file-conversion)

- Agent Markdown: [https://docs.univer.ai/overview/features/shared/file-conversion.md](https://docs.univer.ai/overview/features/shared/file-conversion.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.6.2`

- Source: [features/shared/file-conversion.mdx](https://github.com/dream-num/documentation/blob/dev/content/docs/features/shared/file-conversion.mdx)

---

File import and export links external file formats to the content models that Univer uses. Import parses a file into the corresponding product snapshot. Export serializes a product snapshot into the chosen output format.

## From files to snapshots

Office files fall into two groups. `.xlsx`, `.docx`, and `.pptx` are OOXML packages that hold XML and resources such as images. `.xls`, `.doc`, and `.ppt` use older binary structures. CSV and TSV are plain text. Submit the original file in a supported format, and the conversion module handles decoding, package parsing, and resource mapping.

A snapshot is the content state of a product in a form that can be saved and restored. [The six product snapshot schemas are listed below](#snapshot-data-structures).

### Import: file → snapshot

Importing parses content, styles, and resources into the matching product model, whether Sheet, Doc, Slide, Relational Table, or another product.

```mermaid
flowchart LR
    A["1. Source file<br/>XLSX / DOCX / PPTX, etc."]
    B["2. Parse to snapshot<br/>Server SDK"]
    C["3. Calculate as needed<br/>Update Snapshot"]
    D["4. Web SDK<br/>Edit or process content"]
    A --> B --> C --> D
    classDef calculation stroke-dasharray:5 4
    class C calculation
```

### Export: snapshot → file

Exporting reads the current product snapshot and writes the structure and resources of the target format. A snapshot is the content model at runtime, normally transferred or stored as JSON.

```mermaid
flowchart LR
    A["1. Current snapshot<br/>Edited content"]
    B["2. Calculate as needed<br/>Update Snapshot"]
    C["3. Server SDK<br/>Convert to target format"]
    D["4. Output file<br/>XLSX / DOCX / PPTX, etc."]
    A --> B --> C --> D
    classDef calculation stroke-dasharray:5 4
    class B calculation
```

For Sheet, this means calculating formulas, pivots, and number formats according to the selected policy, then updating the snapshot. See [server-side calculation](https://docs.univer.ai/overview/features/shared/server-calculation.md).

### Snapshot data structures

Each product defines its own snapshot contract for persisting content and resource references, usually as JSON. The interface links lead to field definitions, types, and examples.

| Product | Snapshot interface | Main contents |
| --- | --- | --- |
| Sheets | [`IWorkbookData`](https://docs.univer.ai/guides/sheets/model/workbook-data.md#iworkbookdata) | Worksheets, cells, shared styles, and plugin resources. |
| Docs | [`IDocumentData`](https://docs.univer.ai/guides/docs/model/document-data.md#idocumentdata) | Body, paragraphs, styles, headers, footers, and resources. |
| Slides | [`ISlideData`](https://docs.univer.ai/guides/slides/model/slide-data.md#islidedata) | Slides, elements, masters, themes, and resources. |
| Relational Table | [`IBaseSnapshot`](https://docs.univer.ai/guides/bases/model/base-snapshot.md#ibasesnapshot) | Tables, fields, records, views, and their order. |
| Canvas (Canvases) | [`IBoardData`](https://docs.univer.ai/guides/boards/model/board-data.md#iboarddata) | Pages, elements, themes, and resources. |
| PDF | [`IPdfUnitData`](https://docs.univer.ai/guides/pdfs/model/pdf-data.md#ipdfunitdata) | Source document, durable edit state, and resource bindings. |

Call `save()` on the product Facade to obtain the current snapshot, then use the corresponding creation API to restore it. Content that is already loaded is edited through the Facade APIs. For PDF, `pdf.save()` preserves both the source baseline and `editState`.

## Formats by product

The Office and table formats below use the direct Rust Exchange routes. PDF uses its own conversion module and is therefore listed separately in the same table.

| Product | Import / compile | Export | Scope |
| --- | --- | --- | --- |
| [Sheets](https://docs.univer.ai/guides/sheets/features/import-export.md) | `.xls`, `.xlsx`, `.csv`, `.tsv` | `.xlsx`, `.csv`, `.tsv` | CSV/TSV holds one worksheet. |
| [Docs](https://docs.univer.ai/guides/docs/features/import-export.md) | `.doc`, `.docx` | `.docx` | Legacy DOC imports into the Docs model. Output is DOCX. |
| [Slides](https://docs.univer.ai/guides/slides/features/import-export.md) | `.ppt`, `.pptx` | `.pptx` | Legacy PPT imports into the Slides model. Output is PPTX. |
| [Relational Table](https://docs.univer.ai/guides/bases/features/import-export.md) | `.xls`, `.xlsx`, `.csv`, `.tsv` | `.xlsx`, `.csv`, `.tsv` | CSV/TSV holds one table. XLSX supports table and field mapping. |
| [Canvas (Canvases)](https://docs.univer.ai/guides/boards/features/import-export.md) | Mermaid (`.mmd` / source text) | `.pptx` | Mermaid produces an import draft, which is applied through the Canvases Facade before a snapshot is saved. PPTX exports the active page. |
| [PDF](https://docs.univer.ai/guides/pdfs/features/import-export.md) | `.pdf` | `.pdf` | Requires the PDF conversion service, which is separate from the Rust Exchange CLI. |

- `.xls`, `.doc`, and `.ppt` are import formats. Their output formats are `.xlsx`, `.docx`, and `.pptx` respectively.
- A CSV/TSV export contains one worksheet or one Relational Table table. Save the product snapshot when the complete content model and its resources are required.
- Different SDK entry points accept different extensions. For formats such as `.xlsm`, `.pptm`, `.ppsx`, `.ppsm`, and `.potx`, check the deployed backend and the browser API. They are not additional direct Rust CLI format names.

## Calculation during conversion

For supported spreadsheet conversion workflows, file conversion can be combined with server-side calculation:

- Formula calculation fills in missing cached results on import, or recalculates before export according to the selected policy.
- Pivot calculation derives grouping and aggregation from the source data and the pivot configuration, then materializes the results for the snapshot or the exported workbook.
- Number-format calculation turns values into date, percentage, currency, and other formatted display text. CSV/TSV exports can write display values or raw values.

Continue with [Headless and server-side calculation](https://docs.univer.ai/overview/features/shared/server-calculation.md) for the related content-processing workflow.

## Integration

File conversion belongs to the Server SDK. The application provides the upload, task handling, storage, and download endpoints. Snapshot conversion can run without collaboration. Exporting a shared document reads a confirmed revision after pending edits have synchronized.

Start with [File conversion integration](https://docs.univer.ai/server/import-export.md) and [Node.js file conversion](https://docs.univer.ai/server/import-export/node.md).

Format support and preservation of individual features are separate questions. Use each product's feature list and real business files to verify formulas, images, styles, and layout through import, editing, and export.

[Back to all features](https://docs.univer.ai/overview/features.md)
