Skip to main content

dash-univer

PyPI Python License: MIT CI codecov

A Dash component that embeds the Univer spreadsheet — a full-featured, Excel-like sheet with formulas — directly in your Dash app, wired to Dash callbacks.

pip install dash-univer

Quick start

from dash import Dash, html, Input, Output
from dash_univer import UniverSheet

app = Dash(__name__)

app.layout = html.Div([
    UniverSheet(id="sheet", data={
        "id": "wb",
        "name": "My Workbook",
        "sheetOrder": ["s1"],
        "sheets": {
            "s1": {
                "id": "s1",
                "name": "Sheet1",
                "cellData": {
                    "0": {"0": {"v": "Product"}, "1": {"v": "Revenue"}},
                    "1": {"0": {"v": "Widget"}, "1": {"v": 1000}},
                },
            },
        },
    }),
    html.Pre(id="out"),
])


@app.callback(Output("out", "children"), Input("sheet", "data"))
def show(data):
    return f"{len(data.get('sheets', {}))} sheet(s) in the workbook"


if __name__ == "__main__":
    app.run(debug=True)

Run python usage.py in this repo for a fuller live demo.

How it works

UniverSheet mounts a Univer spreadsheet into a <div>. Univer runs in its own isolated React root inside that div, so it never conflicts with Dash's React tree.

The data prop is the whole workbook (Univer's IWorkbookData as a plain dict) and syncs both ways:

  • Sheet → Python: as the user edits, a debounced full snapshot of the workbook is pushed to data, so any callback with Input("sheet", "data") sees the current state.
  • Python → Sheet: returning a workbook from a callback's Output("sheet", "data") re-renders the sheet. The component guards against echoing its own snapshots, so this never causes a feedback loop.

Props

Prop Type Default Description
id string Component id for Dash callbacks.
data dict {} The workbook (IWorkbookData). Round-trips both ways.
debounce number 300 Milliseconds to debounce edit → data updates.
style dict {height: "500px", width: "100%"} Container styles. Give it a height — Univer collapses to zero height otherwise.
className string Container CSS class.

Advanced: the live Univer Facade API is exposed as document.getElementById(id).univerAPI for client-side callbacks or custom JS.

Development

Requires Python ≥3.9, Node ≥18, and Chrome (for the tests).

uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
npm install
npm run build          # webpack bundle + generates the Python classes
python usage.py        # live demo at http://127.0.0.1:8050

pytest --headless      # end-to-end tests (real browser)

npm run build runs webpack (bundling Univer, with React/ReactDOM externalized to the ones Dash provides) and then dash-generate-components, which regenerates dash_univer/UniverSheet.py from the component's PropTypes.

The tests use dash.testing with Selenium; they need a chromedriver matching your installed Chrome on PATH (see Chrome for Testing).

Scope

v1 wraps Univer Sheets (@univerjs/preset-sheets-core) in English. Docs, Slides, other locales, and granular per-cell events are intentionally out of scope for now — the full-snapshot data contract already exposes everything.

License

This wrapper is MIT licensed. Univer itself is Apache-2.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dash_univer-0.1.1.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dash_univer-0.1.1-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file dash_univer-0.1.1.tar.gz.

File metadata

  • Download URL: dash_univer-0.1.1.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dash_univer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8c66cc0e6408686f8893d6cef54c6ec00347ac4b0f1a64bd96edc5628188ee77
MD5 2679e0a8eaf95fec85eee6f9e44f99aa
BLAKE2b-256 d881b2ec3c970ac333acd8d37ca9ea0b9f052513825215f3a067825e543516ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for dash_univer-0.1.1.tar.gz:

Publisher: release.yml on azhar9/dash-univer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dash_univer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dash_univer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dash_univer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73904e55a069a6347f165301a154de196d351be76761629d98b51dd8ce2a9ce7
MD5 beb3ca22dce76a5e206d88be81f78ba7
BLAKE2b-256 5f30397056c18812281cfd3ab869928814f4a79b312de245c2ef1bb292cda9ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for dash_univer-0.1.1-py3-none-any.whl:

Publisher: release.yml on azhar9/dash-univer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page