How can I automatically update Power Queries with new tables/sheets as they are added to a workbook?
Hi Everyone,
I've finished the project for my boss and now working on my personal project y'all have helped me on using VBA. Trying to change it to Power Query and Pivot Tables now that I learned more about them.
Here's my situation, I want the power queries to automatically update when new sheets/tables are added to the workbook. I did a Google search to ask for help it doesn't seem to be working.
The below is the result from Google:
- Format Data: Ensure all sheets have identical column headers and format data ranges as Tables (
Insert>Table). - Get Data: Go to
Data>Get Data>From File>From Workbook(orFrom Table/Rangefor a single workbook). - Combine: In Power Query, filter the sheets to include only the ones needed. Expand the data.
- Unpivot: Select the columns that should not change (e.g., ID, Name). Right-click and choose "Unpivot Other Columns". This ensures new columns added later are automatically unpivoted.
- Load: Click
Close & Load.
The steps I've done:
- All data on the sheets are formatted as tables with unique names
- Loaded the workbook (current)
- Filtered 'Name' to begin with XXX_ (Tables are named XXX_Mon where XXX is a company identified and Mon is the 3 letter month) -- This step results in the two tables I'm expecting
- Removed 'Item', 'Kind', and 'Hidden' -- This leaves me with 'Name' and 'Daa'
- Expanded the Data column
- A dialog pops up asking what I want, so I select Agent, Score 1, Score 2, Score 3, Score 4
- After clicking OK, I now have 'Name' & the above columns prefixed with Data.
- I selected 'Name' and 'Data.Agent' and right-clicked and picked Unpivoted Other Columns
- Renamed 'Attribute' to 'Eval'
- Renamed 'Value' to 'Score'
- Final Result: Name, Data.Agent, Eval, Score
- Click on Close & Load To...
- Selected Only Create Connection
- Click on Add this data to the Data Model
This is showing all the records (50) as expected. When I add a new sheet named XXX Mar with the table name of XXX_Mar. I refresh all, but March isn't loading in to the Power Query (still showing 50 records).
What am I doing wrong to have the query auto-add the new table?
[link] [comments]
Want to read more?
Check out the full article on the original site