Calculate with a Workbook Function and Write the Result
A 4-step recipe with Microsoft Excel. We can help you get access.
Recipe · 4 steps
Calculate with a Workbook Function and Write the Result
with Microsoft Excel
Invoke an Excel workbook function and persist its result into a cell.
- Open a persisting session so the calculation reads a consistent view of the workbook and the written result is saved.
- Read the cells backing the calculation so the caller can record exactly which inputs produced the result that is about to be written.
- Invoke the named Excel function through the workbook functions endpoint. Excel returns a 200 with an error field set when the function itself fails, so a 200 alone is not proof of a usable result.
- Write the computed value into the target cell so the workbook carries the answer alongside the inputs that produced it.
What you'll need to have ready
- itemId: The drive item id of the workbook file.
- worksheetIdOrName: The worksheet holding the input and result cells.
- inputAddress: The A1-notation range holding the values that back the calculation (e.g. "A1:A3").
- functionName: The Excel function to invoke (e.g. "pmt", "npv", "vlookup").
- functionParameters: The function's named parameters as key-value pairs, matching the argument names Excel expects (e.g. {"rate": 4.5, "nper": 12, "pv": -1250}).
- resultAddress: The A1-notation single cell the computed value is written to (e.g. "B5").
For your developer
Arazzo workflow microsoft-excel:workbook-function-calc, 4 operations: createWorkbookSession → getRange → callWorkbookFunction → updateRange. Specs on APIs.io.