web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / how can I use a variab...
Power Automate
Unanswered

how can I use a variable as a index of a data Table?

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

 

need your help, I need so use a variable inside another variable.

For example I have a ExcelData and if I want second row first columm I will do %ExcelData[2][1]%

What I want is %ExcelData[%LoopIndex%][1]%

But I have a syntax error, how can I use a variable as a index of a data Table?

I have the same question (0)
  • ryule Profile Picture
    929 Super User 2024 Season 1 on at

    Remove the % signs from the inner variable(s). Try this: %ExcelData[LoopIndex][1]%

  • VJR Profile Picture
    7,635 on at

    ryule is right. 

     

    For future reference and more details here

     

    What you need to know is in this section of the documentation.

    VJR_0-1656385591074.png

     

     

  • ammadak11 Profile Picture
    9 on at

    Hi I have figured it out...

     

    Suppose if your Variable value is in the form of Text and not in Integer/number then you can use the option "Convert text into number"

     

    If you then use your variable in lets suppose %CSVTable[varRow][varColumn]%

     

     

    Hope it will help you. 

     

  • MateusCorrea Profile Picture
    9 on at

    I tried your sugestion and removed the % signs from varRow, but didn't worked

    %Legend[varRow]['type']%

     

    Tha value of varRow is 16, and PA found this error: The variable Legend does not have a property '16'.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Is the value of varRow a numeric value, or have you set it with quotes? Also, is %Legend% a data table?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have the exact same problem and it's strange. I'm questioning whether it's a bug in the somewhat recent version of PAD I'm using. I also tried converting the variable to a number and to text as part of my testing, neither worked... A clear case of variableName = 0 and using variableName doesn't work but 0 does.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    If the variable is of type text, it won't work. For example, if you use Find or replace in data table, the output indexes in %DataTableMatches% are strings (no idea why, though) and must first be converted to numbers before they can actually be used to retrieve a value from the table.

  • ammadak11 Profile Picture
    9 on at

    check the data type from your loop. if it is a text output it will not work. To get the value from DataTable fron Index reference, input should have to be integer. 

     

     

  • MateusCorrea Profile Picture
    9 on at

    This is exactly what I did, I used Find or replace in data table to get a row that I need... Now Im trying to use that data.

    How can I convert to numbers?

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Use Convert text to number on each separate value from the %DataTableMatches% variable.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 474

#2
11manish Profile Picture

11manish 268

#3
David_MA Profile Picture

David_MA 243 Super User 2026 Season 1

Last 30 days Overall leaderboard