title: Power Query to Append to Existing Table
body: <p>I recently switched to PowerQuery to fetch data from various sources. I have loaded my existing data to a table called "masterEntries".</p>
  
  <p>The query I have calls a function to check the last record for each source in "masterEntries" and fetches only newer records. </p>
  
  <pre><code>let
      Source = Excel.CurrentWorkbook(){[Name="formsMaster"]}[Content],
      #"Changed Type" = Table.TransformColumnTypes(Source,{{"FormName", type text}, {"Form", type text}, {"LastEntry", Int64.Type}}),
      #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each formEntries([FormName],[LastEntry])),
      #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"EntryId", "Field1", "Field2", "Field3", "Field5", "DateCreated"}, {"EntryId", "Field1", "Field2", "Field3", "Field5", "DateCreated"}),
      #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Form", "LastEntry"}),
  in
      #"Removed Columns"
  </code></pre>
  
  <p>This query loads the data to a new table. Instead I want to append the data to "masterEntries".  </p>
  
  <p>I am trying to do this with PowerQuery and not VBA. PowerQuery has Append Query feature where two or more queries/results can be combined to a new table. </p>
  
  <p>Even a new query to append the resulting table from above query ("latestEntries") to existing table ("masterEntries") will do.</p>
  
  <p>Any ideas on how it can be done with PowerQuery?</p>
  
  <p><strong>EDIT</strong></p>
  
  <ol>
  <li>My original data ("masterEntries") was loaded manually. It is a big table with 400K+ records. I can load it using a query if that is going to help.</li>
  <li>Every run of "latestEntries" checks what records are already in "masterEntries" and fetches only newer entries from different sources.</li>
  <li>The Append Query method in Power Query is just a connection. It does not append records permanently. That is, when "latestEntries" brings a new set of records, the "masterEntries" loses the records that were in the earlier run of "latestEntries".</li>
  </ol>