Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 1PqxlF5FAWl0vMIf1YIahf
Power Automate - Power Automate Desktop
Answered

Looping through Excel

Like (0) ShareShare
ReportReport
Posted on 8 Jan 2024 03:30:19 by 61

How to loop through an excel using for each or loop condition and delete excel rows based on some column value . 

  • Verified answer
    Agnius Bartninkas Profile Picture
    10,045 Most Valuable Professional on 13 Jan 2024 at 06:31:32
    Re: Looping through Excel

    You can use the Find and replace cells in Excel worksheet action to find the column and row indexes for a cell where a match was found.

    -------------------------------------------------------------------------
    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.

  • Sh99 Profile Picture
    61 on 12 Jan 2024 at 16:51:03
    Re: Looping through Excel

    Is there any other option for getting the row number of an excel if a particular value is found? 

  • Sh99 Profile Picture
    61 on 12 Jan 2024 at 15:35:52
    Re: Looping through Excel

    Thanks this is helpful !!

  • DeepaliJagtap Profile Picture
    68 on 09 Jan 2024 at 09:36:35
    Re: Looping through Excel

    Hi,

    You can use counter variable before loop to keep track of row number to be deleted and increment it in loop. Please find below screenshot to delete row based on certain column value: in below screenshot Fruit is highlighted which is column name mentioned in "" i.e. "Fruit" and Orange is value mentioned for that column to delete that row. In delete action I added +2, as first row is taken as header in read from Excel worksheet action and row index starts with 0 so to delete exact row, added +2 in row counter.

    DeepaliJagtap_3-1704792747928.png

     

    Please mark this as solution if it helps you solve issue. Happy to help you more. 🙂

     

  • UshaJyothiKasibhotla Profile Picture
    6 Super User 2025 Season 1 on 08 Jan 2024 at 16:11:57
    Re: Looping through Excel

    On which column based you need to delete rows write that condition in if activity and then use delete rows activity 

  • Sh99 Profile Picture
    61 on 08 Jan 2024 at 14:23:38
    Re: Looping through Excel

    Hello, 

     

    Thank you for your response. I used the same logic, however I am unsure as to what to mention in row number for delete rows if using for each loop and datatable.

  • UshaJyothiKasibhotla Profile Picture
    6 Super User 2025 Season 1 on 08 Jan 2024 at 03:43:26
    Re: Looping through Excel

    First use launch excel activity and then read excel work sheet 

    Then use for each and give input as the datatable which you get from read excel sheet activity and loop through it

    Take if condition and writte condition as below

    Currentitem[columnname] = your value

    In first operand of if activity

    Then select equal to in drop down 

    And write 

    True in the second operand 

    Then inside if activity use delete rows from excel or delete row from data table activities as per your requirement

     

    Hope this helps 

    Usha 

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Power Automate Desktop

#1
eetuRobo Profile Picture

eetuRobo 4 Super User 2025 Season 1

#2
KO-05050229-0 Profile Picture

KO-05050229-0 2

#2
stampcoin Profile Picture

stampcoin 2

Overall leaderboard