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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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?

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
Super User
Super User

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors