How to use Power Query to do INSERT INTO (table1 from table2) without VBA

mrchonginhk

Well-known Member
Joined
Dec 3, 2004
Messages
679
How to use Power Query to do INSERT INTO table 1 from table2 (not UNION) without VBA
I am not allowed to use VBA on my project so I am trying to use PowerQuery
I have 2 tables in their respective worksheet in the same workbook.
TableA is the master data table.
TableB is new records table which is adding records per day but any record of prior day will be wiped out before new records are added.

I need to repeatedly add Table B into Table A.
I am using Excel Power Query to Append these two Tables but what it does is only stick 2 tables together based on the data now.
What I want is, for example, in day 1, Table B has record ABC.
Then I want on run query the 1st day, Table A = Original Table A + ABC
The next day when Table B is updated as XYZ,
I want on 2nd run, the Table A become
Original Table A + ABC + XYZ

Right now the Merge query is only giving me Original Table A + XYZ (ie original Table A + latest Table B only) on 2nd run. ie this is only a UNION query,
not really an Append Query....

I am using below but it fails

let
Source = Table.InsertRows(Table1,0,Table.ToList(Table2))

in
Source

Pls help. Thanks
 
Last edited:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
In this case, the Master query below, is a self referencing query as explained in the link provided by anvg.

The "Remove Duplicates" will prevent new records from being added to the Master multiple times.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Master"]}[Content],
    Custom1 = Source & NewRecords,
    #"Removed Duplicates" = Table.Distinct(Custom1)
in
    #"Removed Duplicates"
 
Upvote 0

Forum statistics

Threads
1,213,515
Messages
6,114,080
Members
448,548
Latest member
harryls

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top