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 to update a datata...
Power Automate
Answered

How to update a datatable value by using for each function

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Community,

 

I am new to PAD.. Please help me with below datatable question. Thanks a lot!!

 

There is a datatable which was generated from website but some fields are blank.

 

What I want to is to use for-each function to loop the datatable and then use a current item field to another current item field (same row).

 

I have tried "CurrentItem[2]" to set "CurrentItem[1]" which is ok for current item but can not update the related value of datatable I am looping.

on99username_1-1640934772481.png

 

 

Datatable:

on99username_0-1640934721779.png

 

And I also tried to use this way to update but it only can update the related row I set..So I want to use the variable to locate next row I want to update but seems there is no way to use.. Any ideas? 

on99username_2-1640935134930.png

 

 

 

 

I have the same question (0)
  • Rkv_ Profile Picture
    166 on at

    As of now there is no way to update the datatable variable directly. 
    You can try writing the datatable to excel a blank excel sheet. then you can use SQL quires on the excel to modify the data, Then you can read the modified data from excel sheet using Read from Excel action and that will create a new datatable.

    Fyi,

    https://docs.microsoft.com/en-us/power-automate/desktop-flows/how-to/sql-queries-excel

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Sad to know that PAD can not do this directly which is such kind of basic function..

    Anyway, thanks for your suggestion!!

  • Verified answer
    Rkv_ Profile Picture
    166 on at

    I can give you one more suggestion here, instead of doing SQL queries on Excel,
    There is one simple way for your requirement. Please don't use for each loop, as you need to update each row and you will be looping through the same row.

     

    So try using the Loop action, loop from 0 to %Datatable.RowCount-1% and increment by 1
    inside the loop you can simple set variable.

    Rkv__0-1640944100107.png

    I hope this is the solution you are looking for. 
    Please mark it answered if you are satisfied.

     

  • VJR Profile Picture
    7,635 on at

    Hi @Anonymous 

    Could you take a look and see at the solution in this post and if it is in line with what you are looking for.

    https://powerusers.microsoft.com/t5/Power-Automate-Desktop/Update-datatable/m-p/1286967/highlight/true#M7139

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks VJR also!!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 796

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 538

Last 30 days Overall leaderboard