Forum Discussion
Get data from dynamic columns without affecting by changes
- 1 year ago
Hi Anonymous -you can use Power Query's Table.ColumnNames function. This function dynamically retrieves all column names from a table, allowing you to expand all existing columns without hardcoding them.
Please check the attached pq code, hope it works
It does.
But I would like to have tolerance for unexpected data format changes in the future.
e.g. column added/removed, column header order changed, name changed, moved up/down to other row, etc.
column parellal level is quite improved from other solution of this post below,
but column with row level still needs to be improved.
Since it does, you can promote the first row in your Custom.Data to header in a custom column prior to expanding. The question now is the row header always in the first row? If not, there should be a column in the source that always contains a value (will never be blank) and will always stay in the same column position. If both conditions are not met, it will be a big problem - code may work now but not in the future.