SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Function renderFormula

    • Renders a formula's analysis report: its text, calculation status, behavioral flags, the identifiers it names, the ranges it references, and its token stream.

      Parameters

      Returns Promise<string>

      Analysis, not state. A cell report answers "what is here" — value, format, memberships. This answers "what does this expression do", which is a different question with a different shape, and is why formula is its own kind rather than a section of cell.

      It computes. evaluate() is asynchronous by contract, which is why this report went without a value for as long as it did — but "what does =SUM(H14:H25) come to" is the most common question anyone brings to a formula, and answering it with a token stream sent the reader off to make a second call for the number they already asked for. One await buys the whole difference, and calculation has already settled by the time a renderer runs (see renderMarkdown).

      The flags are printed only when true. isValid is the exception, printed only when false: a formula that failed to parse is the finding, and a parse failure is not the same as an error result — =1/0 parses fine and evaluates to #DIV/0!.

      Symbols resolve themselves. An agent reading =SUM(Revenue) cannot act until it knows whether Revenue is a defined name, a table column or a header string — three different objects with three different next calls, and the text alone does not say which. The section names each one and what it points at, which also makes the two silent failures loud: a name that no longer resolves, and a function that does not exist (the #NAME? an agent would otherwise diagnose from the value). Symbols, not Identifiers: the skills teach the names roster as "the symbol table", so this is the per-formula slice of a concept the reader already has, under the word they have for it.

      Cell references stay in References rather than joining it — an address is self-describing, and that listing is indexed because the index is the argument to setReferenceAt.

      A DEFINED NAME renders through here too, because a name IS a formula plus an identity — the SDK models it that way (INamedFormula extends IFormula, INamed) and so does this report. It gains an identity header and a Dependents section; everything else is the same analysis, because the questions are the same ones. A separate renderer would have had to answer them twice.