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 optimize For ea...
Power Automate
Unanswered

How to optimize For each loop faster like i have 10000 records how to do this more faster

(0) ShareShare
ReportReport
Posted on by 125

like i am sharing u ss of my flow

Power Automate 22-02-2022 23_05_46.png

Power Automate 22-02-2022 23_05_54.png

Power Automate 22-02-2022 23_06_01.png

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

    Could " extract text from pdf " rather than Ocr...

    ( if they are pdfs )

  • dheeraj867 Profile Picture
    125 on at

    nope they are images

  • dheeraj867 Profile Picture
    125 on at

    how can i optimize this for each loop go faster with 10000 records also

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Assuming OCR is the hold up, would it be possible to process one while OCR'ing the other?

     

    What if it was two bots.  One bots job was to download the document, process the OCR, and save the raw text to a single cell.  Then it was the second bots job to read the Excel text, parse it, and write to Excel.

     

    The second bot doesn't need to focus text to work in Excel.  It just bounces back and forth between the raw text workbook and the workbook you want to enter the parsed text on behind the scenes.

     

    Your first bot needs to pass the %DataFromWebPage.RowsCount% to an Environment Variable for the second bot to pull:  Set environment variable %LoopMax% to %DataFromWebPage.RowsCount%

     

    Chances are, the second bot will outrun the OCR bot, so put in a proper [if data exists] function to force it to wait for data; your second bot should look something like this:

     

    Get environment variable %LoopMax%

    Loop starting at 2 (assuming a title row on the raw text excel file and on the output excel file) to %LoopMax% increment of 1

        'Attach to Excel (raw text)

        Create Label "Retry" 'we will come back here if there is no data

        Read from Excel A & %LoopIndex% to %OCRText%

        If %OCRText% is empty (or equals %''%) note:  those are two apostrophes - not one quotation mark

            Wait 5 (not necessary, but otherwise this will probably bog down your processing power as it continuously loops quickly)

            Go to Label "Retry"

        End (IF)  'so this will continue to loop through until %OCRText% is not empty.

        'Parse Text (same as you did before)

        'Attach to Excel (your output one)

        'Write to Excel (same as before)

        'Set variable %OCRText% to %''% (those are two apostrophes - not one quotation mark)

     

    Best of luck!

     

  • dheeraj867 Profile Picture
    125 on at

    i little bit got it like can u give me tips like we have 10000 records how to run this flow more faster

  • UK_Mike Profile Picture
    on at

    Is that a typing error in Parse Text " Sit Rmet Corp " ? 🤔

  • dheeraj867 Profile Picture
    125 on at

    no no i am using regex for that so i am learning regex ignore this i just tried to do something new😅

  • dheeraj867 Profile Picture
    125 on at

    my main question is that like in this i have like 10 invoices and its taking 30 sec in a for each loop to run this imagine if i have 1000 invoices then u dont think that it will take to much time so i want optimize it and take less time

  • dheeraj867 Profile Picture
    125 on at

    Automation Challenge - OCR (rpachallengeocr.azurewebsites.net) and this is the task which i am doing

  • UK_Mike Profile Picture
    on at

    It is what it is...

    Reduce the delay to Zero and it will be done in the blink of an eye, but it will be wrong.

    Working with web takes time, Ocr takes time, Excel takes time, dont rush it.

    Imagine, youve just done your 10,000 records and theres 1 wrong, 1 wrong = all wrong.

     

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

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 419

#2
Vish WR Profile Picture

Vish WR 314

#3
David_MA Profile Picture

David_MA 260 Super User 2026 Season 1

Last 30 days Overall leaderboard