List.ReplaceRange Function in Power Query

The List.ReplaceRange function returns a list that replaces count values in a list with a replaceWith list starting at specified position, known as index. The first item in the list has index 0.

Syntax

List.ReplaceRange(list as list, index as number, count as number, replaceWith as list) as list

The parameters of the function are:

Example:

Power Query M

let
  source = {"India", "America", "Canada", "Japan", "Australia", "England", "China"}, 
  return = List.ReplaceRange(source, 2, 4, {"Bhutan", "Nepal"})
in
  return

The output of the above code is shown below:

List.ReplaceRange function in Power Query