dream-num/dsh-univer-office/univer-cross-unit-formula
- community
Checking that the SKILL.md file is still in the repository.
Author, calculate, update, inspect, and verify cross-Unit formulas through DSH tools and the Lite Interface. Use proactively when a Sheet cell or formula-driven Shape in a Sheet, Doc, Slide, or Board reads a Sheet range or Base table column from another Unit in the same .univer file.
Install
npx vskill@latest install dream-num/dsh-univer-office/univer-cross-unit-formulaSKILL.md
Cross-Unit formulas
Load univer, the Host Unit skill, and the Sheet or Base Source Unit skill first. This Skill owns the external Source binding, formula, calculation, and cross-Unit verification; the Host skill owns coordinates, content, and visual behavior.
Cross-Unit formulas support two consumers:
- a Sheet cell;
- a regular Shape in a Sheet, Doc, Slide, or Board whose displayed text comes from the formula result.
Resolve the public API
Before authoring, call univer_api for FRange.setFormula, FShape.setFormula, FShape.getFormulaResult, FShape.removeFormula, FFormula.buildReference, FFormula.upsertExternalReference, and FFormula.onCalculationResultApplied.
Use explicit host and source handles. Do not select either Unit through getActive*(). Resolve by the Unit IDs chosen from univer_status, for example univerAPI.getWorkbook(hostUnitId), univerAPI.getWorkbook(sourceUnitId), or univerAPI.getBase(sourceUnitId).
Reference rules
- The caller supplies the source Unit.
buildReference()serializes a reference; it does not discover Units. - Use
sourceUnit.getName()asformulaQualifier; formulas address Units by name while metadata preserves stable IDs. - Use
SHEET_RANGEfor a Sheet range andTABLE_COLUMNfor a Base table column. - Let
buildReference()quote and escape Unit, sheet, table, and column names. - Sheet cells and formula-driven Shapes read the Host's external-reference metadata.
- A cell reads the persisted mapping directly. A Shape receives both formula and complete Source identities in
setFormula(). - Subscribe to calculation completion before
setFormula()or before changing referenced data, then await it.
Sheet Source binding
Resolve both Units and build the reference in one univer_execute call targeting the Host:
Sheet cell consumer
Continue in the same execution and subscribe before writing:
Formula-driven Shape consumer
Create a regular Shape through the Host Unit skill, then bind it to the same reference and Source identity:
Base Source binding
For a Base source, build a table-column reference:
tableName must be the Source Base's real OOXML formula identifier and columnName the real field name. Never pass table as a placeholder. For a Shape, use UNIVER_BASE in externalReferences.
Existing formula text
For hand-written or imported formula text, persist the Host mapping first and fail when rejected:
The qualifier in formula text and metadata must match exactly. After rebinding, rewrite the formula and await calculation; executeCalculation() alone does not necessarily reparse an existing formula against new Host metadata. Prefer buildReference() for names requiring quoting.
Host Shape differences
| Host | Create Shape | Read by stable ID | |
|---|---|---|---|
| Sheet | worksheet.insertShape(...) | worksheet.getShape(shapeId) | |
| Doc | document.insertShape(...) | document.getShape(shapeId) | |
| Slide | slide.insertShape(...) | slide.getShape(shapeId) | |
| Board | board.insertShape(...) | board.getShape(shapeId) |
Once a live Shape exists, formula APIs are identical. Fully qualify the source so behavior does not depend on implicit active context.
Update and remove
FRange.setFormula() replaces a cell formula. FShape.setFormula() replaces a Shape formula. A referenced Source mutation schedules recalculation; subscribe before changing it:
Format a formula-driven Shape with setFormulaNumberFormat and control its supported formula animation with setFormulaAnimationEnabled. shape.removeFormula() converts it to a regular Shape while preserving content and style; use Host deletion only when the Shape itself should be removed.
Acceptance
After the final mutation:
- For a cell, resolve a fresh range and assert exact formula plus expected cached value.
- For a Shape, resolve by stable ID and assert
isFormulaShape(), exact formula, and successful result with expected raw value, display text, and number format. - Change one referenced Source value, await calculation, and prove the consumer changes as expected.
- Inspect Host and Source Units, then follow the Host Unit Skill's
univer_screenshotworkflow. Confirm the selected cell or Shape renders, the UI remains responsive, and geometry, number format, and clipping are correct in the returned image. Browser availability of an unloaded external Source is product-dependent; do not claim a visually updated result unless the captured View resolves it. - Complete the
univerreadback, ready, and status workflow.
Headless model readback is the calculation evidence. Do not claim Viewer resolution of an unloaded Source unless the actual preview demonstrates it.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/univer-cross-unit-formula/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dream-num/dsh-univer-office/univer-cross-unit-formula)