Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
ankitvardhan987
Regular Visitor

Mutiple workbook with multi work sheet

Hi i have 30 people excel file and in each file i have 52 week sheets in which the format is same but ya data is different. Now i have selected a sheet and did the cleaup there. But now i want that the things i did with one file with one sheet will happen to other sheets as well. And then to other file with their sheets too. I have tried but it always show me first sheet data for all files. First sheet data

ankitvardhan987_2-1768113231908.png

transform of sample file for first sheet

ankitvardhan987_1-1768113154831.png

I have made a function but it always show first sheet but i want that first it transform first sheet and then second and so on

ankitvardhan987_3-1768113303080.png

You can see output

ankitvardhan987_4-1768113336676.png

its repeated first sheet data.

 

Note:- Its also giving second file but again first sheet of that file data

1 ACCEPTED SOLUTION
tharunkumarRTK
Super User
Super User

@ankitvardhan987

Since you want to perform same transformation logic to all the sheets and also in all the excel workbooks. Assuming the data structure across all files and all sheets is same. I would suggest to follow the below approach, instead of using the default UI options 

1. I took three excel workbooks, each contains 3 sheets

tharunkumarRTK_0-1768114849984.png

2. I imported them into power bi, Dont click on "combine", click on "Transform"

 

tharunkumarRTK_5-1768116458388.png

 

4. Delete all the columns, except "Content" and "Name" (Unless you need those other columns)

tharunkumarRTK_0-1768115221888.png

5. Using the Excel.Workbook function, converts the binary column to table 

 

tharunkumarRTK_0-1768115413728.png

6. Expand "Content" column, this will bring all the sheets from each file

tharunkumarRTK_0-1768115592989.png

 

 

Optionally you can merge the file name and sheet name if you want 

tharunkumarRTK_1-1768115731083.png

 

7. Now create a power query function for all your transformations, like this. (Please observe, in the function accepts the "Table" as input not the file. It takes table of data as input and performs the transformations)

 

tharunkumarRTK_2-1768115886067.png

8. Now apply the function on the table column

tharunkumarRTK_3-1768116058542.png

As you can see transformations are applied 

9. Now you can expand the "Data" Column to get the full table 

tharunkumarRTK_4-1768116159350.png

Thats it!

power bi file and sample excels are attached

You can read my blogs here: https://techietips.co.in 

 

 

 

 

 

 

Connect on LinkedIn

 

 

 








Did I answer your question? Mark my post as a solution!
If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!


PBI_SuperUser_Rank@2x.png

View solution in original post

5 REPLIES 5
AshokKunwar
Responsive Resident
Responsive Resident

Hii @ankitvardhan987 

 

Instead of relying on the "Combine Files" helper queries that Power BI automatically generates, you should manually expand the sheets to ensure the function reaches every week.

โ€‹Step 1: Modify your "Transform File" Function

โ€‹Your current M-code likely has a navigation step that looks like Source{0}[Data] or uses a specific sheet name. You need to remove the part that selects the first sheet inside the function so that the function can accept any table as input.

โ€‹Change your function code to this pattern:

(SheetData as table) => 
let
    -- Start directly with your cleaning steps using SheetData as the source
    #"Removed Top Rows" = Table.Skip(SheetData, 2),
    #"Kept First Rows" = Table.FirstN(#"Removed Top Rows", 18),
    -- ... (rest of your existing cleaning steps)
in
    #"Removed Columns1"

 

Step 2: Connect to the Folder and Expand Sheets

  1. โ€‹Get Data > Folder and select your folder with the 30 files.
  2. โ€‹Click Transform Data (do NOT click Combine).
  3. โ€‹Add a Custom Column: = Excel.Workbook([Content]).
  4. โ€‹Expand that new column to show the Data column (this contains the raw tables for all 52 weeks) and the Name column (the sheet name).
  5. โ€‹Now you have a row for every sheet in every file.

โ€‹Step 3: Invoke the Function on the "Data" Column

  1. โ€‹Go to Add Column > Invoke Custom Function.
  2. โ€‹Select your modified function.
  3. โ€‹For the input parameter, select the Data column you just expanded.
  4. โ€‹Finally, expand the resulting column to see your cleaned data from all sheets.

If this allows you to see all 52 weeks of data for all 30 people, please mark this as the "Accepted Solution"!

cengizhanarslan
Memorable Member
Memorable Member

If you have many workbooks with similar structure (same sheet names + same columns):

  1. Place all the Excel files in a single folder.

  2. In Power BI Desktop:

    • Home โ†’ Get Data โ†’ Folder

    • Browse to the folder.

    • Combine & Transform Data

  3. In the Combine Files window:

    • Choose the sheet/tab you want to import from each file (e.g., โ€œDataโ€).

    • Power BI will generate a query that reads that sheet from every file in the folder.

  4. Transform as needed.

One query that automatically includes all sheets from all files, no need to manually handle each workbook.

_________________________________________________________
If this helped, โœ“ Mark as Solution | Kudos appreciated
Connect on LinkedIn
tharunkumarRTK
Super User
Super User

@ankitvardhan987

Since you want to perform same transformation logic to all the sheets and also in all the excel workbooks. Assuming the data structure across all files and all sheets is same. I would suggest to follow the below approach, instead of using the default UI options 

1. I took three excel workbooks, each contains 3 sheets

tharunkumarRTK_0-1768114849984.png

2. I imported them into power bi, Dont click on "combine", click on "Transform"

 

tharunkumarRTK_5-1768116458388.png

 

4. Delete all the columns, except "Content" and "Name" (Unless you need those other columns)

tharunkumarRTK_0-1768115221888.png

5. Using the Excel.Workbook function, converts the binary column to table 

 

tharunkumarRTK_0-1768115413728.png

6. Expand "Content" column, this will bring all the sheets from each file

tharunkumarRTK_0-1768115592989.png

 

 

Optionally you can merge the file name and sheet name if you want 

tharunkumarRTK_1-1768115731083.png

 

7. Now create a power query function for all your transformations, like this. (Please observe, in the function accepts the "Table" as input not the file. It takes table of data as input and performs the transformations)

 

tharunkumarRTK_2-1768115886067.png

8. Now apply the function on the table column

tharunkumarRTK_3-1768116058542.png

As you can see transformations are applied 

9. Now you can expand the "Data" Column to get the full table 

tharunkumarRTK_4-1768116159350.png

Thats it!

power bi file and sample excels are attached

You can read my blogs here: https://techietips.co.in 

 

 

 

 

 

 

Connect on LinkedIn

 

 

 








Did I answer your question? Mark my post as a solution!
If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!


PBI_SuperUser_Rank@2x.png

Thanks followed the steps and did minimal changes and got the answer

Hii @ankitvardhan987 

 

If this allows you to see all 52 weeks of data for all 30 people, please mark this as the "Accepted Solution"!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.