List.InsertRange Function in Power Query

The List.InsertRange function is a versatile M language function used to inject a sequence of values into an existing list at a specific position. Unlike simple concatenation which adds items to the end, List.InsertRange gives you precise control over where new data appears within your list structure.

Power Query uses zero-based indexing, meaning the first position in any list is index 0, the second is index 1, and so on. Understanding this indexing is key to placing your data exactly where it's needed.

Syntax

List.InsertRange(list as list, index as number, values as list) as list

Parameters

Return Value

The function returns a new list containing all the original items plus the newly inserted items at the specified index.

Example: Insert the given values in the list at index 3.

Power Query M

let
  source = {12456, 127895, 128690, 125478}, 
  return = List.InsertRange(source, 3, {"Ashish", "Goel"}) 
in
  return     

The output of the above code is shown below:

List.InsertRange function in Power Query