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 / Update Data Table Item...
Power Automate
Answered

Update Data Table Item - Row Index

(0) ShareShare
ReportReport
Posted on by 8

I have a flow where I am loading an excel spreadsheet into a data table variable %ExcelData%.  There are a total of 15 columns with the last one containing empty cells.  In my flow, I have If/Else conditions in place where based on an image or lack of image, an action is taken. Specifically, for the Else, for the %CurrentItem% I want to write to the data table in the empty Column.  I have been getting stuck on the syntax for the row index so it is writing to the data table for the current item in the specified column. I've tried a couple different things but get the error for row index should be an integer.

2024-06-27_15-37-42.jpg
I have the same question (0)
  • Verified answer
    CU16071609-1 Profile Picture
    6,255 Moderator on at

    @hum313 

     

    You can follow the below approach:

     

    Guide:

    Step 1: Launch Excel and Open a Specific File

    • Launch Excel and open the file EmpDetails.xlsx located in C:\Boot\.

    Step 2: Read All Cells from the Excel File

    • Read all the data from the Excel file into a variable called ExcelData.

    Step 3: Initialize a Counter

    • Set a counter variable to 0.

    Step 4: Loop Through Each Item in the Excel Data

    • Loop through each row in the ExcelData.

    Step 5: Check for Empty Cells in the First Column

    • If the cell in the first column (column A) of the current row is empty, update it with the value Already Acquired.

    Step 6: Increment the Counter

    • Increment the counter by 1.

    Deenuji_0-1719541126132.png

     

    Code:

     

    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Boot\\EmpDetails.xlsx''' Visible: True ReadOnly: False Instance=> ExcelInstance
    Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: False FirstLineIsHeader: False RangeValue=> ExcelData
    SET Counter TO 0
    LOOP FOREACH CurrentItem IN ExcelData
     IF IsEmpty(CurrentItem[0]) THEN
     Variables.ModifyDataTableItem DataTable: ExcelData ColumnNameOrIndex: $'''A''' RowIndex: Counter Value: $'''Already Acquired'''
     END
     SET Counter TO Counter + 1
    END

     

     

    How to copy/paste the above code into your power automate desktop?

    Deenuji_1-1719541193123.gif

     


    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 🚀

  • hum313 Profile Picture
    8 on at

    Thank you for the input! That's not exactly how this will work so i'm not sure how to apply it for what I need, my apologies.

     

    In column O for each item, depending on the If/Else condition for an Image, there will be one of three entries made in the cell. Once I can get this one sorted out, i'll be able to get the other two in place.

     

    High level, If an image exists, there will be a set of steps to take within the flow....else update the data table item in Column O with the provided value, click a button, and move on to the next item in the data table and go through the flow again.  

    2024-06-28_10-42-22.jpg
  • hum313 Profile Picture
    8 on at

    I was able to resolve it using what you provided so thank you!  

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 284 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 188 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 144 Super User 2026 Season 2

Last 30 days Overall leaderboard