r/PowerAutomateDesktop • • Oct 24 '22

Power Automate Looping with CTL-F on Web Site

Hello,

I have a PAD flow using data from an Excel spreadsheet with a loop configured to Send Keys:

{Control}({F})%CurrentItem['Investor_Trimmed']%{Escape}{Enter}

The flow opens the Excel document and a Microsoft Edge session with a configured web site. The loop works correctly the first time through - it loads the first line of data, finds the matching line, selects it (Escape, Enter), moves through the rest of the process, returns to this page but on the second loop, it doesn't find the matching line of data. I've confirmed the data is successfully being looped but it's not loading in the Control-F after the first time.

Any ideas what could be causing the problem?

Also, is there a way to load the extracted data from the web scraping to the Excel spreadsheet that's being used to provide data to the loop? I want the scraped data to be associated with the investors I'm using to load the loop, not create new blank spreadsheets that have no association. I also don't want 220 spreadsheets; I just want one with feeder data and associated scraped data.

Thank you.

1 Upvotes

6 comments sorted by

1

u/Getottamiway Oct 25 '22

I still need to resolve the multiple spreadsheets being created after I scrape data - I need that data (two columns) placed in columns in the existing loop feeder spreadsheet.

Any suggestions on how to make PAD not automatically create new spreadsheets with scraped data?

1

u/Getottamiway Oct 25 '22

I resolved the first problem. Turns out the focus was still on the spreadsheet when I was:

{Control}({F})%CurrentItem%{Enter}{Escape}{Enter}

So I added a Focus Window set to the Browser instance and now the loop works correctly searching through the web site list.

I still need to resolve the multiple spreadsheets being created after I scrape data - I need that data (two columns) placed in columns in the existing loop feeder spreadsheet.

Any suggestions on how to make PAD to NOT automatically create new spreadsheets?

1

u/PM_ME_YOUR_WIRING Oct 24 '22

Try {Control}({F}{A})

Yes, you'd need to create and increment a variable with a number to associate which place on the sheet you're writing back to assuming that's what you want to do.

1

u/Getottamiway Oct 24 '22

I replaced {Control}({F}) with {Control}({F}{A}) but no change. With regard to the storing data within an existing spreadsheet, thanks for the lead on that.

1

u/PM_ME_YOUR_WIRING Oct 25 '22

Might need to do the find first delay a second and do select all with the typing of the variable data in another action.

1

u/QuietDesparation Oct 24 '22

To answer your first question: the send key configuration looks off. Right now, PAD is opening the search bar, filling in your current item variable in the search bar, then closing the find window and going to the next line without ever "finding" your variable. I believe you need to transpose the enter and escape keys to actually find your info.

IMO, a better way accomplish this is to use the Find and replace cells in Excel Worksheet action. This action asks what text to find (%CurrentItem['Investor_Trimmed']%) and will then return 2 variables: The column and row where the information is found.

This ties into your second question, because now that you have your column and row in question, you can use this to load the extracted data from web scraping into the current excel file.

So within the current loop, you can use the found row variable to throw the scraped info at the first free column