modern-xlsx API Reference - v1.3.0
    Preparing search index...

    Function rewriteFormula

    • Rewrite references in a formula after a row/column insert or delete.

      Parameters

      • formula: string

        Formula string (with or without leading =).

      • action: RewriteAction

        The insert/delete action to apply. start is a 1-based row number for insert_rows/delete_rows and a 0-based column index for insert_cols/delete_cols (unified in 2.0). An insert shifts references at index >= start; a delete removes [start, start + count), turning a cell ref inside it into #REF!, shrinking a range that overlaps it, and shifting the rest back. An undefined sheet touches unqualified references only. 3-D and structured references are never changed.

      Returns string

      The rewritten formula string, or formula unchanged when it does not parse or rewriting it exhausts the call stack.