INSERT

Inserts an item into an array at a given index.

Syntax 

INSERT(array, index, item)

Usage examples 

Example 1

Formula

INSERT(["a", "b", "c"], 1, "x")

Output

1
[
2
"a",
3
"x",
4
"b",
5
"c"
6
]

Example 2

Accepts negative indexes.

Formula

INSERT(["a", "b", "c"], -2, "x")

Output

1
[
2
"a",
3
"b",
4
"x",
5
"c"
6
]
Was this helpful?