Expand description
Macro tokens: references in step parameters that are worked out when the step runs, so a macro made on one block of data works on another.
A token is a base followed by methods:
- bases: a declared input (
Input,Rates),Output(the output rule’s anchor),RoworColumn(the current item of the Repeat step around it), andName:Total(a defined name or a table’s data; a name can hold periods, and the longest one that exists is used, soName:Sales.Q1.cell(1,1)is a cell ofSales.Q1); - methods, 1-based and chainable:
.col(n)or.col("Amount")(by an input’s header row, also after.data),.row(n),.cols(a..b),.rows(a..),.cell(r,c)(relative to the top-left cell; any whole numbers, socell(0,1)is the cell above),.offset(r,c),.resize(h,w),.data(without the header row),.below(n)and.right(n)(the n rows below or columns right of the range).
In parameters a token is written three ways: {"$ref": "Input.col(2)"} anywhere; the whole
string "Input.col(2)" in a reference parameter (cell, range, target, to, keys ending
in Cell or Range…); or {{Input.col(2)}} inside any string ("=SUM({{Input.col(2)}})").
Each becomes A1 text before the command runs, so commands never see a token. Text that would
read as a token is written {"$text": "Output"}: it is passed as it is, never resolved or
interpolated (a defined name called Output, or Dear {{name}}). Plain A1
references in steps are absolute: they don’t follow row inserts (as in VBA); a Name: anchor
does.
Structs§
Enums§
- Resolve
Error - Why a reference couldn’t be worked out.
Functions§
- a1
placeas A1 text, with the sheet name when it isn’t the active sheet.- interpolate
- Replaces each
{{token}}ins.{{{{is a literal{{, for text that needs the braces themselves ("Dear {{{{name}}"writesDear {{name}}). - is_
ref_ key - Whether a parameter called
keyholds a reference. - is_
token - Whether
textstarts like a token (its base is one this environment knows). A reference on a sheet with such a name (Output!A1) is not a token. - quote_
sheet Sheet1or'My Sheet'(quotes doubled).- reads_
as_ token - Whether
textwould read as a token in a macro whose inputs areinputs(seeis_token). - resolve_
params - Step parameters with every token replaced by A1 text.
- resolve_
ref - Resolves a token, or a plain reference (
B2,Sheet2!A1:C3, a defined name). - resolve_
token - Resolves a token (see the module docs).