List.InsertRange
A list with other items put in at a position.
Group: List. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
List.InsertRange(list as list, index as number, values as list) as list
| Parameter | Type | Description |
|---|---|---|
list | list | The list. |
index | number | Where the new items go, counted from 0; the list's count puts them at the end. |
values | list | The items to insert. |
Returns
list. The list with the new items in place.
Examples
Two products in the middle
List.InsertRange({"Coffee", "Milk"}, 1, {"Tea", "Juice"})
{"Coffee", "Tea", "Juice", "Milk"}
At the end
List.InsertRange({"Coffee", "Milk"}, 2, {"Water"})
{"Coffee", "Milk", "Water"}