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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
lishapruthi
Helper I
Helper I

Combine files with different column structure

Hi Everyone,

 

There is one question, Can we combines files with differnt structure in Powerquery. Example : one excel file contain column A, B, C, D but second file contains A, B, C, D, E
Can we combine those files and get the result in one table like A, B, C, D, E

Please let me know if there is any solution to get the above solution.

 

Thanks,

Lisha

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lishapruthi ,

Replace the expanded column names with the following code:

List.Distinct(List.Combine(List.Transform (#"Removed Other Columns1"[Transform File],each Table.ColumnNames(_))))

vcgaomsft_0-1705916800638.png

vcgaomsft_1-1705917425817.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi Lisha,

You can put them in a folder.

vcgaomsft_1-1705904202452.png


Here use Combine & Transform data --> Ok.

vcgaomsft_2-1705904227894.png

An automated query is executed here:

vcgaomsft_3-1705904279533.png

Check the table under Other Queries --> Go to this query --> Manually expand and remove the following extra steps

vcgaomsft_4-1705904450583.png

vcgaomsft_5-1705904547952.png

Output:

vcgaomsft_6-1705904575028.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Hi @Anonymous ,

 

But is there any solution to get columns dynamically because everytime new file added in the folder there willl be more columns than previous files. In that case, we cannot update in powerquery everytime. it should be added automatically.How can we solve this issue.

 

Thanks, 

Lisha

Anonymous
Not applicable

Hi @lishapruthi ,

Replace the expanded column names with the following code:

List.Distinct(List.Combine(List.Transform (#"Removed Other Columns1"[Transform File],each Table.ColumnNames(_))))

vcgaomsft_0-1705916800638.png

vcgaomsft_1-1705917425817.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Hi,

 

This solution is the closest I've come to being able to do this. I'm running into an error though. I have 4 files in a folder and I'm getting the following error at this last step. It may be because only one of my files says it's setup as a table. If so, could you help guide me?

 

lbry9_0-1742492285181.png

 

Vallirajap
Resolver III
Resolver III

Hi @lishapruthi,

Using merge queries to join the two tables into a single table. but there are similar columns needed to make a join between the two tables.

Did I answer your question?

Mark my post as a solution, this will help others...!

Hit the kudo also,

Thank you.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.