I received a question recently from a community member, they had asked why their dynamic content from their excel table was not accesible in the dynamic content menu. As it turned out they were dynamically selecting the excel file like below

Screenshot of trigger of 'when a file is created' in power automate and a list rows present in a table step using dynamic content to select the excel file and table

In this scenario the user was uploading an excel file into a document library, this excel file contained a table called Table 1 that had the same structure across each of the uploaded documents. The community member wanted to take the rows in excel and move them into Dataverse but was unable to as Power Automate could not generate the dynamic content as it didn’t have a defined table schema it could refer to.

Fortunately there is a way to still access this content dynamically when the table structure is known. Lets take an example table

Screenshot of example excel table with year, month, quarter, title and comments columns.

When we upload this excel file with the flow in it’s current state the list rows function provides us outputs in JSON format. If we know the strucutre of the excel table then we can accurately predict what the JSON format is and manually define the dynamic content using an expression. In this case if the JSON looks like this

Screenshot showing the JSON outputs of the List rows present in a table step.

Then the expression to access just the year of the first item would look like this:

first(outputs('List_rows_present_in_a_table')?['body/value'])?['Year']

This expression slightly changes if we are trying to access it in an apply to each loop, in that instance the expression becomes:

items('Apply_to_each')?['Year']

Using this method we can easily access the content of a known structure. However it’s worth noting that when you first put the above expression in it will appear as an expression normally would

Screenshot showing the expression described above as an input to a compose step inside a apply to each loop

But after saving the flow and refreshing the page it will now look like normal dynamic content

Screenshot showing the expression turned into normal dynamic content in power automate.

Which means now it can be copied and pasted as you would normal dynamic content.

This method of accessing dynamic content from a dynamically selected table can be really useful to understand. It’s a good first step into understanding how to select content from JSON arrays which is a useful skill to have when working in Power Automate. If you would like to know more about using this method in Power Automate let me know in the comments and we’ll dig in deep to see how it can be leveraged.

One response to “Power Automate – Accessing Dynamic Content from a Dynamically Selected Table”

  1. […] This trick is essential when working with JSON arrays, HTTP calls, or dynamic table names and also lets you use outputs from actions that aren’t available via the dynamic content menu. If you want to learn a bit more I wrote a post about using this to resolve issues with a dynamically selected excel table […]

    Like

Leave a reply to Top 5 tips for learning Power Automate — beginner edition – Power Nerd Insights – Power Platform Tips and Tricks Cancel reply

Trending