Forum Discussion
Excel with different Schema (Missing Columns Errors)
- 8 months ago
Hi gordgord1, the correct approach depends on how you're using that/those missing column(s).
If you don't need the column in your report, you can set the file where the column is missing as the Sample File that is used as the "master" defining all the columns you expect in the other files too.You can do that either during the "Combine Files" step if you select "Combine & Transform" or by adjusting the Sample File in the Helper Queries:
If you do need the column but can accept that you'll have some null values, you can select the file that includes the column(s) as your Sample File instead. In that case the column will contain null-values for all rows of the sources that didn't contain the column.
- 8 months ago
If you are performing the same transformations to each table in the list of tables and you are selecting the same columns from each table you could use the Table.TransformColumns function in place of the stock UI combination.
If you have a starting point similar to...TableA
TableB
The following code will skip the first 5 rows, promote the headers and select the columns you indicated.
Table.TransformColumns( Source, { { "Data", each Table.SelectColumns( Table.PromoteHeaders( Table.Skip(_, 5) ), {"keepA", "keepB", "keepC", "keepD", "keepE"}, MissingField.Ignore ), type table [keepA=nullable text, keepB=nullable text, keepC=nullable text, keepD=nullable text, keepE=nullable text] } } )Once the tables are combined the result looks like...
I have attached the pbix for you to inspect as well.
- 8 months ago
This video solved my problem. How to use Power Query to Combine Multiple Files that have different headings by Access Analytic.
https://www.youtube.com/watch?v=09tvia_8ykI&t=1s
I had to further process the files and remove rows and promote headers in the "sample transform file". It was not working until I deleted the "changed type" that was added. Completely fixed my problem.
This video solved my problem. How to use Power Query to Combine Multiple Files that have different headings by Access Analytic.
https://www.youtube.com/watch?v=09tvia_8ykI&t=1s
I had to further process the files and remove rows and promote headers in the "sample transform file". It was not working until I deleted the "changed type" that was added. Completely fixed my problem.