Forum Discussion
Issue while combining multiple CSV files with multiple inconsistent column names and numbers
Hi CR21 ,
The screenshot is not clear enough, but still here are 2 approaches that you can use.
Please have a look at the following video, unless you haven't already and hopefully it works out for you.
Managing changing column names in Power Query #10: (M)agic (M)ondays - YouTube
Another way that you can do, is that I can see that you have an 'Invoked Custom Function' step in your query.
I am assuming that the column sort order will be the same in your CSV files and at some point in that function query you have Promoted First Rows to headers.
So before Promoting Headers, you can try to replace the item in the first row, based on another value that will be constant in your headers, using this code. (Beware of case sensitivity in Power Query)
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",each[ColumnX],each if Text.Contains([Column3], "Date") then "Location" else [ColumnX],Replacer.ReplaceText,{"Location"}),
In this case, Column3 is my static column which has the header 'Date' using that I am replacing the values in ColumnX with 'Location'.
You can use a similar approach, if the video does not work for you.
Hope this answers your question and if it does please accept is as a solution, so that others can resolve the issue faster.
Thank you,
Vishesh Jain