As topic, is there a way to show all column name from a sharepoint list? maybe a function that can generate a collection that contain all column name from a SP list?
I'd recommend using Power Automate to get the column names. I got the idea how to solve using @3tsolutions 's post here: https://powerusers.microsoft.com/t5/Building-Power-Apps/How-get-columns-name-from-sharepoint-list/m-...
Here's the gist:
1. Get Items from your list (Top Count = 1).
2. Create CSV table (Columns = Automatic).
3. Create Variable that is a string of the headers.
4. Create an Array variable from the string of headers:
When run will give you this output that contains all the column titles. You can copy from the output and paste into your formula (clean the list as needed)
Paste into PowerApps with column names cleaned as required (I had to remove a few that were causing errors and some others I didn't want):
Takes a few minutes to set up but is worth it to get the column names especially if you need to write out (for e.g.) 50 columns.
Try this code, to retrieve all column names from SharePoint List. This worked for me.
Set the variable in OnVisible action for the screen and add the variable as a datasource for the dropdownlist.
Set( ColumnNames, Distinct( Ungroup( MatchAll( JSON( SharePointListData, JSONFormat.IgnoreBinaryData & JSONFormat.IgnoreUnsupportedTypes ), "([^""]+?)""\s*:" ).SubMatches, "SubMatches" ), Value ) )
Please mark as answer, if this helps.
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
We are excited to announce a new way to share your ideas for Power Apps!