Power Query append a list of tables from Access

cr731

Well-known Member
Joined
Sep 17, 2010
Messages
611
I have a table in an Excel worksheet, and I want to append together all tables from a specific Access database that are listed in the table.

Can this be automated in Power Query without needing to write a line of code for each table?

Currently, I'm basically doing this,

Code:
Source1 = SourceTable {0}[Column]1,
Source1Access = Access.DataBase(File.Contents("networkpath\File.mdb")){[Schema="",Item=Source1]}[Data]

Source2 = SourceTable {0}[Column]1,
Source2Access = Access.DataBase(File.Contents("networkpath\File.mdb")){[Schema="",Item=Source2]}[Data]

CombinedSources = Table.Combine(Source1,Source2),

And basically have to repeat for every line in my table representing a source.

It would be great if I could pass one list to Table.Combine but I'm not sure how to get it to correctly pull those tables from Access.

Thanks
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Table.Combine takes in a list of tables, so it can be applied to a column whose fields contain tables: Table.Combine(YourMasterTable[FunctionResult])
So turn your "Source"-query to a function (and name it function) and call it from YourMasterTable - passing the column that lists the Access-tables (AccessTables) to the function.

(Table) =>
let
Source = Access.DataBase(File.Contents("networkpath\File.mdb")){[Schema="",Item=[B]Table[/B]]}[Data]
in
Source

So your query would look like this:

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
FunctionCall = Table.AddColumn(Source, "FunctionResult", each function([AccessTables])),
Custom1 = Table.Combine(FunctionCall[FunctionResult])
in
Custom1
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,836
Members
449,096
Latest member
Erald

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