Control Flow
Lido provides action formulas for controlling the execution flow of actions — chaining them in sequence, running them in parallel, repeating, pausing, and debugging.
CHAIN
Executes multiple actions in sequence, one after another. This is an action formula.
Syntax:
=CHAIN(action1, action2, ...)
=CHAIN(action1, action2, ..., delay)
Parameters:
| Parameter | Description | Required |
|---|---|---|
action1, action2, ... | Action-returning formulas or cell references to action cells | Yes |
delay | Optional delay in milliseconds between each action (must be the last argument and a non-negative number) | No |
Example:
=CHAIN(COPYFILE(source, dest), SLEEP(2000), PRINT("Done"))
Copies a file, waits 2 seconds, then prints a message.
=CHAIN(A1, A2, A3, 500)
Runs the actions in cells A1, A2, and A3 in order, with a 500ms delay between each.
BATCH
Executes multiple actions in parallel. This is an action formula.
Syntax:
=BATCH(action1, action2, ...)
=BATCH(action1, action2, ..., batch_size)
Parameters:
| Parameter | Description | Required |
|---|---|---|
action1, action2, ... | Action-returning formulas or cell references to action cells | Yes |
batch_size | Maximum number of actions to run concurrently (must be the last argument and a non-negative number; default: 10000) | No |
Example:
=BATCH(SENDGMAIL(cred, "a@b.com", "Hi", "Body"), SENDGMAIL(cred, "c@d.com", "Hi", "Body"))
Sends both emails simultaneously.
=BATCH(A1:A100, 5)
Runs actions in cells A1 through A100 in batches of 5 at a time.
REPEAT
Repeats an action a specified number of times. This is an action formula.
Syntax:
=REPEAT(action, count)
Parameters:
| Parameter | Description | Required |
|---|---|---|
action | Action-returning formula to repeat | Yes |
count | Number of times to repeat | Yes |
SLEEP
Pauses action execution for a specified number of milliseconds. This is an action formula.
Syntax:
=SLEEP(milliseconds)
Parameters:
| Parameter | Description | Required |
|---|---|---|
milliseconds | Duration to pause in milliseconds | Yes |
Example:
=SLEEP(5000)
Pauses for 5 seconds.
PRINT
Outputs a message for debugging and logging purposes during action execution. This is an action formula.
Syntax:
=PRINT(message)
=PRINT(message, color)
Parameters:
| Parameter | Description | Required |
|---|---|---|
message | The text to output | Yes |
color | Color for the message in the output console (default: "gray") | No |
Example:
=PRINT("Processing complete for " & A2)
=PRINT("ERROR: Missing data", "red")