Hi all
I get data from several environments, and they might not all have the same columns. In order to be able to "align" those, so I can use the same Power Query on them, I add some columns, if they do not already exist.
I do this with the following code:
if List.Count(List.FindText(Table.ColumnNames(Source), "Colors" ))= 1 then Source else Table.AddColumn(Source, "Colors", each "", type text)
This works well, and it will create a column called "Colors", if it does not exist and if it already exists, it does nothing.
The problem is that FindText does not search for exact text. So if I have 2 columns, respectively called "Fruits" and "BlueFruits", and does the same thing with "Fruits", it will count both columns, not just "Fruits".
How can I use the same principle, to create new columns, if they not not exist, but only based on exact matching search?
I attached a demo sheet that shows the problem.
Best regards
Imbizile
Bookmarks