Hey all,
I have a problem when i try to add a column in excel in the last one and when i refresh the data flow relative with sharepoint path. It can not be added because in the first 4 excel doesnt exist this column and i have to write manually. I can do that for 4 excel but after 100 excel and if we want to add add one more column in 101 excel i have to write all filter again and again. How can I add a column automaticly. I mean i want to create a function which helps to scan every column and if there is a value bring this value in any case if there is not value, i dont want to see this null column.
Hi @v-jingzhang,
Thank you so much for answer. However it didnt work tho. Actually I used 2 source transformation and inside of one source I am using a function that I work on it. I have to fix this function than it will work for sure. I want to bring datetime, attribute and value column as well.
My excel table is someting like this =
and I´d like to add one more column in the last excel file for example B005 but although there is no column something like b005 in the last excel files so i am getting error like there is no column which is B005 so we it can´t bring this column as well.
Here you can see my function and i tried to apply it but it didn´t work. If you help me further, I will be really appreciated.
Hi @dodurukan
You can use Table.ColumnNames function to get all existing column names of a table and check whether a column exists among them.
Add a custom step in the formula bar with below code and modify "previous step" accordingly. When the column you are finding exists, it will return the table as it is. When the column doesn't exist, it will add a column with this column name. I'm not sure what result you want to add in the new column so I use null as an example. You can modify the results per your need.
= if List.Contains(Table.ColumnNames(#"previous step"), "findingColumnName") then #"Changed Type" else Table.AddColumn( #"previous step", "findingColumnName", each null)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!