Excel.CurrentWorkbook in Power Query: How to Use It
In this article
Excel.CurrentWorkbook is the Power Query function that lets a query read tables and named ranges that live in the same workbook as the query itself. You use it when you want to pull data from an Excel Table (ListObject) or a defined name into Power Query without pointing at an external file. The short version: create an Excel Table, open Power Query, add a blank query, type = Excel.CurrentWorkbook(), then expand the Content column and filter to the table you want. The function returns a table with Name and Content columns, and each Content value is itself a nested table or record that you expand.
What You'll Need
- Excel for Windows or Excel for Mac with Power Query built in (Excel 2016 and later have it on the Data tab; the exact ribbon label can differ slightly by version and region).
- Your source data formatted as an Excel Table (select the range, then Insert > Table) or as a defined name (Formulas > Define Name).
- The workbook saved as .xlsx or .xlsm. Power Query works in .xlsb too, but some older .xls files are not supported.
- Basic familiarity with the Power Query Editor: the Queries pane on the left, the formula bar, and the Applied Steps list on the right.
Step-by-Step
- Format your source as an Excel Table. Select the data range including headers, then go to Insert > Table and confirm the range and that "My table has headers" is ticked. Give the table a clear name in Table Design > Table Name (for example, SalesData). Spaces in the name work but make later steps harder to read, so use underscores or camel case.
- Open Power Query. With any cell in the workbook selected, go to Data > Get Data > Launch Power Query Editor. On some versions the button is labelled "From Table/Range" and opens the editor directly; either route works.
- Create a blank query. In the Power Query Editor, go to Home > New Source > Other Sources > Blank Query. A new query called Query1 appears in the Queries pane.
- Enter the function. With Query1 selected, click in the formula bar (or go to Home > Advanced Editor) and type
= Excel.CurrentWorkbook(). Press Enter. The preview shows a two-column table: Name and Content. - Filter to the table you want. Click the filter arrow on the Name column and untick everything except your table name (for example, SalesData). This keeps the query focused and avoids pulling in unrelated named ranges.
- Expand the Content column. Click the expand icon (two arrows pointing away from each other) in the Content column header. In the dialog, untick "Use original column name as prefix" if you want clean headers, then click OK. The nested table expands into columns.
- Check data types. Power Query usually detects types automatically, but verify each column header icon. Click the icon and choose the correct type (Whole Number, Decimal Number, Date, Text). Wrong types cause errors later in merges and calculations.
- Load the result. Go to Home > Close & Load. Choose "Table" to put the output on a worksheet, or "Only Create Connection" if you plan to use it inside another query or the Data Model. Loading to a worksheet is the simplest option for a first test.
- Refresh after edits. When you change the source table, go to Data > Refresh All (or right-click the output table and choose Refresh). The query re-reads the workbook and updates the output.
Common Mistakes
- Using a plain range instead of a Table. Excel.CurrentWorkbook only sees Excel Tables and defined names. A raw cell range such as A1:D20 is invisible to the function. Convert it to a Table first.
- Forgetting to expand Content. Many people stop after filtering the Name column and wonder why they see a single column of nested tables. You must click the expand icon and choose the columns you want.
- Duplicate table names. Excel does not allow two Tables with the same name in one workbook, but a defined name can collide with a Table name in confusing ways. Rename carefully.
- Loading the query back into the source table's sheet. If the output table overlaps the source table, refresh fails with a "something went wrong" or overlap error. Load to a different sheet or to the Data Model.
- Assuming the function reads other workbooks. It does not. Excel.CurrentWorkbook is scoped to the workbook that contains the query. For other files, use Excel.Workbook with a file path or a folder connector.
- Editing the source table's structure after loading. Adding or removing columns in the source Table is fine, but renaming a column that the query references by name causes errors until you update the step.
Tips
- Name your Tables descriptively before you start. The Name column in Excel.CurrentWorkbook is your only filter handle, and generic names like Table1 make queries hard to maintain.
- If you need several Tables from the same workbook, keep one Excel.CurrentWorkbook query and duplicate it, then change the Name filter in each copy. This is faster than rebuilding the function each time.
- Use defined names for single values (a tax rate, a start date) and Tables for tabular data. Excel.CurrentWorkbook returns both, but a defined name that points to one cell appears as a record or scalar, not a table, so handle it differently.
- When you expand Content, untick the prefix option. Otherwise every column becomes "SalesData.ColumnName", which is noisy in downstream steps.
- Keep the source Table on its own sheet if possible. It makes refresh errors easier to diagnose and avoids overlap problems.
- If you plan to use the result in Power Pivot or the Data Model, load with "Only Create Connection" and add it to the model from the Power Pivot window or the Data > Manage Data Model route, depending on your Excel version.
Troubleshooting
If the query returns an empty table or only a single row with no data, check that the source is genuinely an Excel Table (the Table Design tab should appear when you click inside it) and that the Name filter matches exactly, including case and underscores. If the Content column shows "Error" instead of a table, the named range may be broken or point to a deleted sheet; open Formulas > Name Manager and confirm the reference.
If refresh fails with an overlap error, move the output table to a different sheet or reduce its size so it does not collide with the source. If columns appear with the wrong type or as errors after expansion, set the type explicitly in the Changed Type step rather than relying on detection. If the function is not recognised, you are likely in an older Excel version without Power Query, or you typed the name with a space; the correct spelling is Excel.CurrentWorkbook with no space and a capital C and W.
If the workbook is shared or co-authored, refresh behaviour can differ and some users see stale data until they refresh manually. Save a local copy and test there before assuming the query is broken.
Frequently Asked Questions
Can Excel.CurrentWorkbook read data from another workbook?
No. It only reads Tables and defined names inside the workbook that contains the query. For external files, use the Excel.Workbook function with a file path or the Folder connector.
Does it work with named ranges as well as Tables?
Yes, but the output shape differs. A named range that covers a block of cells behaves like a table; a name pointing to a single cell returns a scalar or record, which you handle with different steps.
Why do I see a column of nested tables instead of my data?
That is expected. The Content column holds each Table or range as a nested object. Click the expand icon in the Content header and choose the columns you need.
Do I need to refresh after changing the source table?
Yes. Power Query does not update live. Use Data > Refresh All or right-click the output and choose Refresh. For automatic updates, set the query to refresh on open in the connection properties.
Can I use Excel.CurrentWorkbook in Power BI Desktop?
No. The function is specific to Excel. Power BI uses different connectors and does not have a current-workbook concept in the same way.
What happens if I rename the source table?
The query breaks because the Name filter no longer matches. Either rename the table back or edit the filter step in the Power Query Editor to the new name.