I am trying to use the 'Extract data from webpage' action to extract just the first few items from a list of span elements on a webpage. Every time I select up to the second item, it automatically selects all the items for extraction. I do not need all the items, just the first 10 items. How do I go about this, please?
Solved! Go to Solution.
Every time I select up to the second item, it automatically selects all the items for extraction
This is by design that PAD automatically detects and gives us a table based on the first two selections.
Here are some options for what you are trying to do.
1. Extract just the first item. See its html in the Advanced Settings and likewise get the second item.
/..../Div(0)/Input(0) -> if this gives the first item
/..../Div(0)/Input(1) -> then get the second item separately
Either use a separate Extract data from webpage or use the Handpicked values option of the Extract data from webpage to extract both at once
2. If you are having trouble with that then to get the first few items of a list below is the syntax
If MyList is your list then use %MyList[0:2]% to get the first two items.
Thank you for the response. How do I do this though. Do I add the extract action into the the loop and then select the first item to be extracted while the loop extracts the rest?
Thank you for the reply. I have tried using the handpicked option but I noticed it only extracts the values into just one row rather than in one column like a list would look like. I want to loop through the values extracted and so having everything in just one row would make it look like a single value only. I hope you get me.
For the syntax part of the answer:
Do what you were originally doing ie;
"'Extract data from webpage' action ....Every time I select up to the second item, it automatically selects all the items for extraction"
When you run this action in PAD it will give you the result in a datatable.
Then you can use a For each loop on the datatable and just get the top required rows. ie; If you need top 3 items then exit the loop after 3 iterations of the loop.
Ok, I get that. I actually want to continually loop through the first ten items without exiting, at least not until the flow itself is stopped.. Is there a way to do this?
- Have a Counter variable set to 10
- Within the loop have a If condition to check if the value of Counter is greater than 10. If yes, use Exit Loop.
- Just before the loop end, increment the counter by 1
Keep up to date with current events and community announcements in the Power Automate community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!