Power BI Functions — Table.ColumnNames, List.Select and List.Count
Finding relevant tables to work with within a bunch of CSVs can be very difficult. Finding these files with little to no documentation can be time consuming, and typically involves browsing through the column names of each CSV.
I was recently working on a project that contained many CSVs. I only wanted to use the CSVs that contained a certain column. Instead of loading all the tables into Power BI, including the ones without the columns, there is a much easier way to do this!
How do we find a specific column name among so many CSVs?
Table.ColumnNames is one option. There is, however, another cool function called Table.HasColumns, which will return “TRUE” or “FALSE” depending on whether a CSV contains the column.
Here is how to go about it.
- Load the CSVs using the folder connector in Power Query.
2. Change the binary CSV files into Tables and promote the headers. like below.
3. Now use Table.HasColumns to find the column in each of the CSVs using the below code.