Skip to content

getReplaceSheetReferencesFn

getReplaceSheetReferencesFn(): Promise<ReplaceSheetReferencesFn>

Make a function that replaces sheet names in formulas in a syntactically sound way. That means: (a) it will only affect occurrences of the previous name in reference prefixes (not e.g. in string literals), and only in those reference prefixes that have the given workbook name, or (if includeNoWb is true) have no workbook name. (b) it takes quoting into account, including changing references to/from quoted form as appropriate. (c) it matches sheet names and workbook names case-insensitively.

This is an async factory for such a function because we need to dynamically import the waspiary module which is the actual implementation. The returned function is synchronous.

The returned function throws FormulaSyntaxError if the given formula is not parseable to begin with.

Promise<ReplaceSheetReferencesFn>