Add variables to a Data Table on Power Automate Desktop

Power Automate Desktop - Solutions

I’ve been asked this question many times; ‘FlowJoe how do I add variables to a DataTable and not hard coded data?’ so here is a blog post on how to solve it!

Firstly, you should be familiar with the syntax of adding items to a data table. If you’re not check out the video at: https://www.youtube.com/watch?v=rkU9r95UxJs

Therefore you should understand that %DataTable + [‘Flow’, ‘Joe’]% will add the string ‘Flow’ and ‘Joe’ to column one and two.

However, when we add variables into the mix you would think that: %DataTable + [%FirstName%, %LastName%]% would work, but it throws an error.

This is because you have already declared the % signs. Adding another after the [ for the first variable of %FirstName% essentially tells Power Automate Desktop that you are selecting a variable of %DataTable +[% as you’re closing the %% signs.

What you need to do is remove the %% signs from your variable, as they’re within declared %% signs of %DataTable + % they will be picked up.

This will result in your code looking like: %DataTable + [FirstName, LastName]% (The variables FirstName and LastName will be picked up even though they do not have their own %% signs). Check out the image below for a real example: