Table.InsertRows Function in Power Query
The Table.InsertRows function returns a table with the list of rows inserted into the table at the given position, specified by the index number. Each column in the row to insert must match the column types of the table.
Syntax
Table.InsertRows(table as table, index as number, rows as list) as table
Note: The index starts from 0.
Example: Insert the rows at the index position 1.
Power Query M
let MyTable = Table.InsertRows( Table.FromRecords( { [CustomerID = 1, Name = "Ashish", Phone = "123-4567", Company = "TCS"], [CustomerID = 2, Name = "Katrina", Phone = "987-6543", Company = "TCS"], [CustomerID = 3, Name = "Alia", Phone = "543-7890", Company = "TCS"] } ), 1, { [CustomerID = 4, Name = "Vicky", Phone = "676-8479", Company = "TCS"], [CustomerID = 5, Name = "Mohini", Phone = "574-8864", Company = "TCS"] } ) in MyTable
The output of the above code is shown below: