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 / Iteration on Excel fil...
Power Automate
Answered

Iteration on Excel file - Loop not stopping

(0) ShareShare
ReportReport
Posted on by 18

Hello,

I have an excel file which my loop doesn't stop on the last result/row.

This file will have a different number of rows filled everyday, so its not static:

 

Excel01.png

 

Here is my loop:

 

Excel02.png

After it reads the last row with data, it will keep trying to populate the browser (above) with empty data from empty rows.

 

 

My 2 questions:

1-How to make it stop on the last row with value, and;

2-How to clean all rows on excel.

 

*All rows with data must be erased once its done, because I faced the following:

Yesterday, 20 lines were written on the excel.

Today there was only 10 lines to be written, so it overwrote the first 10 lines, but the other 10 lines was the results from yesterday.

 

 

Thanks for your help in advance.

  • Verified answer
    AS-06081019-0 Profile Picture
    1,738 Super User 2024 Season 1 on at

    @Davis_C  Please refer this https://youtu.be/1WezrCQlpBY 

    it should work 

  • PhilipTreacy Profile Picture
    120 on at

    Hi @Davis_C 

     

    Excel treats cells with formatting as active i.e. they contain something.  You have a column of dates, so I suspect that the format for those cells is one of the Date formats in Excel.

     

    Even if you delete the data in those cells from inside Excel, the formatting (date) remains and Excel treats those cells as active.

     

    Open the Excel file and press CTRL+END, where does the active cell go to? Check that cell's format.  Even if you get cells like this back to General format the problem remains.

     

    Deleting the range of cells using PA will remove formatting too, but I guess you are not deleting all cells containing formatting.

     

    If you open the file and use CTRL+END you'll see the last active cell and know what row and column you need to delete up to.

     

    If you don't do this, using Get first free column/row from Excel worksheet will not work as you expect

     

    regards

     

    Phil

     

  • Davis_C Profile Picture
    18 on at

    Thank you! It really worked.

    If someone is having the same issue, you need to define the ending as FirstFreeRow/Column -1

    See Ankesh Youtube link

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

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 389

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard