Skip to main content
Community site session details

Community site session details

Session Id : 8VwJDdsaO7xVdkM2eboGzA
Power Automate - Power Automate Desktop
Unanswered

for each item in datatable

Like (0) ShareShare
ReportReport
Posted on 20 May 2024 08:02:51 by 2

Hi all,

 

In the flow, I use the following actions: 1. Attach to an executing Excel file. 2. Read the entire worksheet and save it in a variable of type ‘DataTable’. 3. Use the ‘For Each’ action on the DataTable to perform specific actions. Namely: 3.1. Execute a VBScript to change the value of specific cells in the table. 3.2. Attempt to capture the already changed value in a variable with the condition ‘item["column name"]’, but it doesn’t capture the correct value. Why?”

  • Deenuji_Loganathan_ Profile Picture
    6,204 Super User 2025 Season 2 on 20 May 2024 at 08:37:36
    Re: for each item in datatable

    @Rusinov 

     

     I agree with @eetuRobo thoughts.

     

    But could you please share vbscript screenshot to investigate further on this issue?


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • eetuRobo Profile Picture
    3,681 Super User 2025 Season 2 on 20 May 2024 at 08:36:28
    Re: for each item in datatable

    Problem is that your loop is using the old datatable. You need to read the excel again to get the updated status.
    Your For each is using the Step 2read from excel which has data that was not updated. The VBScript updates the Excel directly and not your dtQueue variable that is used in For each and then in the set variable Item['Status'].

    So either read the excel again in the for each loop or use WScript.Echo and then refer to the VBScriptOutput when setting the status variable.

  • Rusinov Profile Picture
    2 on 20 May 2024 at 08:33:25
    Re: for each item in datatable

    input file 

    Rusinov_0-1716193477731.png

    my flow

    Rusinov_2-1716193806392.png

     

    output file after run vbs script 

    Rusinov_3-1716193871291.png

    variable in power automate 

    Rusinov_4-1716193913821.png

     

     

     

  • Srini007 Profile Picture
    3,216 Super User 2025 Season 2 on 20 May 2024 at 08:30:09
    Re: for each item in datatable

    Hi @Rusinov 

     

    It should be your item['column name']

     

    Just replace your double quotes to single quotes

     

    Check below for your reference

     

    Srini007_0-1716193928509.png

     

     

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

    Cheers,

    Srini

  • eetuRobo Profile Picture
    3,681 Super User 2025 Season 2 on 20 May 2024 at 08:17:40
    Re: for each item in datatable

    Can you show a screenshot of your flow? 
    What value does it give then? Does it give any value or an error?

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete