Skip to content
SumOfficeSumOfficeSumOffice

Requests used in the example

Opening a workbook, writing text, a number, and a formula, recalculating, and saving — a breakdown of each call.

This breaks down the calls from SumSheet’s first run — the same f1-api-first-run.mjs script the quick start uses to open a workbook, edit three cells, and save the result. The whole script is on the Verified script page; below is each of its requests, one at a time.

{
"operation": "open_workbook_subset",
"sourceUri": "file:///absolute/path/input.xlsx",
"viewport": { "top": 0, "left": 0, "rows": 20, "cols": 12 },
"requestedBackend": "native-desktop"
}

You take payload.subsetId and payload.activeSheet.path from the response.

requestedBackend here is a request, not a requirement. There are three values: native-desktop, wasm, and service-host. If you ask for something other than what’s actually running, there’s no refusal: the core computes with what it has and says so honestly — with the requested-backend-unavailable warning, and the response carries backendUsed and fallbackUsed. So an example carried over from the desktop app to the browser won’t break, but it also won’t actually compute on the engine it names — what else arrives in every response.

{
"operation": "apply_cell_edits",
"subsetId": "subset-...",
"edits": [
{ "sheetKey": "xl/worksheets/sheet1.xml",
"row": 0, "col": 0, "inputKind": "text", "input": "SumSheet API" },
{ "sheetKey": "xl/worksheets/sheet1.xml",
"row": 0, "col": 1, "inputKind": "number", "input": "21" },
{ "sheetKey": "xl/worksheets/sheet1.xml",
"row": 0, "col": 2, "inputKind": "formula", "input": "=B1*2" }
],
"expectedRevision": 0,
"viewport": { "top": 0, "left": 0, "rows": 20, "cols": 12 },
"requestedBackend": "native-desktop"
}

The three edits are sent atomically and create one history entry.

{
"operation": "read_cell_details",
"subsetId": "subset-...",
"row": 0,
"col": 2,
"viewport": { "top": 0, "left": 0, "rows": 20, "cols": 12 },
"requestedBackend": "native-desktop"
}

The value you want is in payload.cell.displayValue, and the formula’s original text is in payload.cell.editText.

{
"operation": "replay_workbook_history",
"subsetId": "subset-...",
"direction": "undo",
"viewport": { "top": 0, "left": 0, "rows": 20, "cols": 12 },
"requestedBackend": "native-desktop"
}

For redo, send the same request with direction: "redo".

{
"operation": "save_workbook_subset",
"subsetId": "subset-...",
"destinationUri": "file:///absolute/path/result.xlsx",
"preserveCachedValues": true,
"requestedBackend": "native-desktop"
}

preserveCachedValues decides the fate of the numbers formulas show in the file. The field is required — it has no default.

Value What ends up in the file The warning in the response
true The formulas themselves and the numbers they show: both what came from the original workbook and what the current session recalculated. cached-formula-values-preserved, if a recalculation is needed somewhere else
false Only the formulas themselves. The numbers are cleared for every formula in the workbook. cached-formula-values-omitted

Documentation assistant

Answers are assembled from the documentation and may be inaccurate — check the sources.