Power Query: Combine Subset of List of Tables that Exist

Abstract: Combine a dynamic subset of existing Excel tables in Power Query by filtering Excel.CurrentWorkbook metadata and merging their content without manual selection.

Created: 2026-10-15 by

To combine a subset of tables in Power Query, use the Excel.CurrentWorkbook() function to retrieve all named ranges and tables, filter that list by specific names or patterns using Table.SelectRows, and then invoke Table.Combine on the filtered contents. This approach dynamically merges only the existing data structures without requiring manual selection or prior knowledge of every table name.

The Problem with Static Merging

Many Excel users attempt to merge multiple tables by manually selecting each one in the Power Query Editor. This method is fragile because it requires constant updates whenever new tables are added or old ones are removed. If you have ten tables and add an eleventh, your existing query breaks or ignores the new data entirely. Furthermore, trying to treat the output of Excel.CurrentWorkbook() as a list of queries directly leads to errors because this function returns a table of metadata (Name, Content, Type) rather than a simple list of query objects.

The core issue is distinguishing between the metadata row and the actual data content. Each row in the result of Excel.CurrentWorkbook() contains a column named Content which holds the actual table data. To combine a subset, we must first identify which rows correspond to the tables we want, extract their Content columns, and then merge those tables together.

Step-by-Step Implementation

Follow these steps to create a robust solution that automatically combines only the tables you specify. This method ensures that if a table is deleted, the query will fail gracefully or skip it, depending on how you handle errors, rather than crashing the entire workbook processing pipeline. For more information on handling missing columns or steps safely, see our guide on Power Query: Perform Applies Steps to a Column Only if it Exists, Avoid Error if it Doesn't Exist.

1. Retrieve All Workbooks Tables

Start by creating a blank query. In the Advanced Editor, enter the following code to get the master list of all tables:

let
    Source = Excel.CurrentWorkbook(),
    // This returns a table with columns: Name, Content, Type
    TableList = Source
in
    TableList

This step creates a reference to all named ranges and tables currently defined in the workbook. Note that this includes non-table items like named ranges that do not contain tabular data, so filtering is essential.

2. Filter for Specific Tables

You need to narrow down this list to only the tables you wish to combine. Use Table.SelectRows to apply a condition. You can filter by exact name or by a pattern using Text.Contains. For example, if your tables are named Sales_2023, Sales_2024, etc., you can filter by prefix:

    FilteredRows = Table.SelectRows(TableList, each Text.StartsWith([Name], "Sales_"))

If you want to combine only specific, disparate tables, you can check against a list of allowed names:

    AllowedNames = {"TableA", "TableB", "TableC"},
    FilteredRows = Table.SelectRows(TableList, each List.Contains(AllowedNames, [Name]))

This step ensures that unrelated tables, such as configuration sheets or static lists, are excluded from the final combination.

3. Extract Contents and Combine

Once you have the filtered rows, you must extract the Content column. The Content column contains the actual table data for each row. Use Table.Column to isolate this, and then pass the resulting list of tables to Table.Combine:

    CombinedTables = Table.Combine(FilteredRows[Content])

Table.Combine takes a list of tables and stacks them vertically. It requires that all tables have the same schema (same column names and types). If the schemas differ slightly, you may need to add a custom column or rename columns in a subsequent step before combining.

Handling Errors and Edge Cases

One common pitfall is encountering tables that have different structures. If Table.Combine fails, it usually means one of the selected tables has a missing or extra column. To mitigate this, ensure that all source tables are formatted consistently. If you move your query into an external file, be aware that Excel.CurrentWorkbook() relies on the local workbook context. For details on managing external dependencies, refer to Power Query: Working Query Fails if Moved Out of Workbook into External File.

Another edge case occurs when no tables match your filter. Table.Combine expects a list of tables. If the list is empty, it may return an error or an empty table depending on the version. To handle this, you can wrap the combination in a conditional logic block or simply accept that an empty result is valid if no data exists.

Performance Considerations

Using Excel.CurrentWorkbook() is efficient because it pulls data directly from the Excel engine without importing files individually. However, if you have hundreds of tables, filtering and combining can become slow. Ensure that your filters are as specific as possible to reduce the number of tables processed. Additionally, avoid combining tables that are already combined; instead, build a hierarchy of queries where smaller subsets are merged first.

Frequently Asked Questions

What if my tables have different column names?

Table.Combine requires identical column names and types. If they differ, you must standardize them using Table.RenameColumns or Table.TransformColumns in a preceding step before attempting to combine. Alternatively, use Table.NestedJoin if you need horizontal merging based on keys.

Can I combine tables from other workbooks?

No, Excel.CurrentWorkbook() only accesses tables within the active workbook. To combine tables from other files, you must use Folder.Contents or connect to individual files via Excel.Workbook and navigate their paths manually.

How do I ignore named ranges that are not tables?

Filter the Type column returned by Excel.CurrentWorkbook(). Typically, tables have a Type value of "Table". You can add a step like Table.SelectRows(Source, each [Type] = "Table") to exclude named ranges, charts, or other objects.

Why does my query break when I delete a table?

If you hardcoded table names in a list and deleted one, the list still references it. Using dynamic filtering with Text.StartsWith or checking existence in Excel.CurrentWorkbook() prevents this. Always rely on the current state of the workbook rather than static lists of names.

Is there a limit to how many tables I can combine?

There is no hard-coded limit in Power Query, but performance degrades with very large numbers of tables due to memory overhead. For best practices, consider grouping data logically or using incremental refresh strategies if dealing with massive datasets.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More