# Insert New Row in Excel Power Query



## legalhustler (Aug 15, 2019)

I have a table with 15 columns in Excel Power Query and want to add a new first row in my table called "Summer", but I only want "Summer to appear in column 1, row 1 and the rest of the row should be empty.  Will need to display the rest of the (15) columns after the new row has been added.  How can I achieve this?


----------



## sandy666 (Aug 15, 2019)

use Table.FromRecords to create Table with single row with Summer in the first column then Append this table with your original table


----------



## legalhustler (Aug 15, 2019)

sandy666 said:


> use Table.FromRecords to create Table with single row with Summer in the first column then Append this table with your original table



If I append, will the record show at the end or the first row of the original table? If the the former is true, then how would I bring the last row as the first row? Thanks.


----------



## sandy666 (Aug 15, 2019)

as I said, Append new single row table with original table and you'll see new row as first in a brand new table

if you want reverse rows in your original table then reverse before Append then Append

edit:
the best way is post a link to *shared *example excel file which reflect structure and data type

btw. don't quote post if it is not necessary, I know what I said


----------



## sandy666 (Aug 16, 2019)

or Table.InsertRows(...)


----------



## legalhustler (Aug 19, 2019)

Do I need to convert my table to a list before I can use Table.FromRecords or Table.InsertRows? How would I do that? I'm trying to add the new record (on the very top, base zero) in the Advanced Editor.


----------



## sandy666 (Aug 19, 2019)

*Header1**Header2**Header3**Header4*aabbccddwweerrtt

with Table.FromRecords


```
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    TFR = Table.FromRecords({[Header1 = "Summer",Header2 = null,Header3 = null,Header4 = null]}),
    TC = Table.Combine({TFR, Source})
in
    TC[/SIZE]
```

with Table.InsertRows


```
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    TIR = Table.InsertRows(Source, 0, {[Header1 = "Summer", Header2 = null, Header3 = null, Header4 = null]})
in
    TIR[/SIZE]
```


*Header1**Header2**Header3**Header4*Summeraabbccddwweerrtt


----------



## legalhustler (Aug 19, 2019)

Worked beautifully. Used Table.InsertRows method since it's less line to type.  Thanks.


----------



## sandy666 (Aug 19, 2019)

sure 

have a nice day


----------



## legalhustler (Aug 30, 2021)

sandy666 said:


> *Header1**Header2**Header3**Header4*aabbccddwweerrtt
> 
> with Table.FromRecords
> 
> ...





sandy666 said:


> *Header1**Header2**Header3**Header4*aabbccddwweerrtt
> 
> with Table.FromRecords
> 
> ...


Using the Table.InsertRows method, how would I do the same thing but add Summer to the last row instead? Thanks.


----------



## legalhustler (Aug 15, 2019)

I have a table with 15 columns in Excel Power Query and want to add a new first row in my table called "Summer", but I only want "Summer to appear in column 1, row 1 and the rest of the row should be empty.  Will need to display the rest of the (15) columns after the new row has been added.  How can I achieve this?


----------



## JGordon11 (Aug 30, 2021)

Change 0 to Table.RowCount(Source)


----------



## legalhustler (Aug 31, 2021)

JGordon11 said:


> Change 0 to Table.RowCount(Source)


Perfect! Just the function I needed to make it dynamic.


----------

