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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Thulasiraman
Helper II
Helper II

Combine files from folder

Hi 

 

I have more than 100 excel files in a Folder which I would like to combine throug Power query.  Most of the files have same number of columns (for example 8 columns) except few which have different number of columns (for example 10 columns, 15 columns ......).  While combining the files, power query takes only 8 columns as it is found in most of the files and omits the additional columns found in other files.

 

How to overcome this.  Your help is most appreciated.  Thanks in advance

 

6 REPLIES 6
Thulasiraman
Helper II
Helper II

Hi @serpiva64 

 

Thanks for your reply.  Saw the video.  I think the video talks about different column names.  In my case, I don't have column names at all.  But different number of columns in each file.

Hi,

you can use something that is in that video.

When you get your table with all the table of data

serpiva64_0-1671535693186.png

if you expand you hard code the names of columns

serpiva64_1-1671535738665.png

So next time you will not get columns if they increase.

Instead if you use Table.Combine you make it dynamic and all columns will be recovered

Click fx

serpiva64_2-1671535928792.png

obtain this

serpiva64_3-1671535967431.png

then modify it 

serpiva64_4-1671536019332.png

= Table.Combine( #"Filtered Rows1"[Data])

and it's done

 

 

 

 

 

Hi @serpiva64 

 

Thanks for the suggested solution.  Will try and come back.

Is the expected result supposed to include the unknown columns?  If they are unknown, how are you using them in your project?  Or are you simply trying to combine the data from all files that contain the specific 8 columns and omit the other columns?

If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

Proud to be a Microsoft Fabric Super User

Hi @jennratten 

 

Thanks for pitching in.  Actually the excile files which I am referring are nothing but Sales Invoices generated in excel.  It is a standard format with 8 columns being used.  But sometimes the clerk uses additional columns for the reasons best known to him.  So it happens that some files contain more than 8 columns.

 

I tried selecting the file with maximum columns as sample file while transforming and combining.  It worked.  But the problem for me to open all the files and see which file has max columns.

serpiva64
Solution Sage
Solution Sage

Hi,

You will find a brilliant solution in this video

Combine Data from Multiple Excel Files with Inconsistent Column Names

by Goodly

https://youtu.be/0ZOY8is-bgY

If this post is useful to help you to solve your issue consider giving the post a thumbs up and accepting it as a solution !

 

 

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Kudoed Authors