In this Power Automate desktop tutorial, we will see how to get items from a list using Power Automate Desktop.
So, here we will cover the below topics, which will give you an idea of how we can get an item using the index in Power Automate Desktop. These topics are:
- Get the first item from the list.
- Get the first few items from the list
- Get specific items from the list
- Get the last items from the list
Get the First Item from a List in Power Automate Desktop
Here, we will see how to get the first items from the list on the Power Automate desktop.
For example, we have a list called names containing [Alex, Ron, John]. To get the first item i.e. Alex, we will pass the index as 0 with the last name, so our expression will be Names[0].
Step 1: Open the Power Automate desktop, provide the flow name, and click on the Create button.
Step 2: Now we will create a List variable called Names, so, expand the variable section. Then drag and drop the Create new list action to Canvas and provide the below information:
- Now provide the new list name as Names, then click on Save.
Step 3: Next, we will add names to the list, for this, expand the variable section, then drag and drop the ‘Add item to list ‘ action to canvas. Then provide the below information:
- Add item: Provide the item name ‘Alex’.
- Into List: Click on the variable icon {x} -> select Names, then click Save.
Similarly, add the other items/names to the list of Names. Next, we will fetch the first item from the list. So here I have added two more names to the list i.e. Ron and John.
Step 4: Now we will get the first item from the list, so expand the Message box section and then drag and drop the Display Message action to the canvas. Then provide the below information:
- Message box title: Provide the title like below.
- Message to display: Provide the below code as a message to display.
%Names[0]%
Step 5: Now run the flow by clicking on the run button, and you can see the message box will pop up with the first item in the list.
This is how we can get the first item from the list in Power Automate Desktop.
Get First Few Items from a List using Power Automate desktop
Here, we will see how we can get the first few items from the list in Power Automate Desktop.
For example, we have a list called names containing [Alex, Ron, John]. To get the few items from the list, we must provide the start and stop indexes. To get Alex and Ron, we can use this expression Names[0,2].
Step 1: Open Power Automate Desktop, provide the flow name, and click on the Create button.
Step 2: Now we will create a List variable called Names, so, expand the variable section. Then drag and drop the Create new list action to Canvas and provide the below information:
- Now provide the new list name as Names, then click on Save.
Step 3: Next, we will add names to the list, for this, expand the variable section, then drag and drop the ‘Add item to list ‘ action to canvas. Then provide the below information:
- Add item: Provide the item name ‘Alex’.
- Into List: Click on the variable icon {x} -> select Names, then click Save.
Similarly, add the other items/names to the list of Names; next, we will fetch the first item from the list. So here I have added two more names to the list i.e. Ron and John.
Step 4: Now we will get the first 2 items from the list, so expand the Message box section and then drag and drop the Display Message action to the canvas. Then provide the below information:
- Message box title: Provide the title like below.
- Message to display: Provide the below code as a message to display.
%Names[0:2]%
Step 5: Now run the flow by clicking on the run button, and you can see the message box will pop up with the first item in the list.
This is how we can get a few items from the list in Power Automate Desktop.
Gets specific items from a list in Power Automate desktop
Here, we will see how to get specific items from the list in Power Automate Desktop.
For example, we have a list called names containing [Alex, Ron, John]. To get the specific item i.e. Ron, from the list, we need to provide the index of the specific item and stop index. To get Ron, we can use this expression Names[1,2].
Step 1: Open Power Automate Desktop, provide the flow name, and click on the Create button.
Step 2: Now we will create a List variable called Names, so, expand the variable section. Then drag and drop the Create new list action to Canvas and provide the below information:
- Now provide the new list name as Names, then click on Save.
Step 3: Next, we will add names to the list, for this, expand the variable section, then drag and drop the ‘Add item to list ‘ action to canvas. Then provide the below information:
- Add item: Provide the item name ‘Alex’.
- Into List: Click on the variable icon {x} -> select Names, then click Save.
Similarly, add the other items/names to the list of Names; next, we will fetch the first item from the list. So here I have added two more names to the list i.e. Ron and John.
Step 4: Now we will get the specific item from the list, so expand the Message box section and then drag and drop the Display Message action to the canvas. Then provide the below information:
- Message box title: Provide the title like below.
- Message to display: Provide the below code as a message to display.
%Names[1:2]%
Step 5: Now run the flow by clicking on the run button, and you can see the message box will pop up with the first item in the list.
This is how we can get specific items from the list in Power Automate Desktop.
Get the Last Item from a List in Power Automate desktop
Here, we will see how to get the last item from a list in Power Automate Desktop.
For example, a list called Names contains [Alex, Ron, John]. To get the last item i.e., John, from the list, we need to provide the index of the last item. To get Ron, we can use the expression i.e., Names[2].
Step 1: Open Power Automate Desktop, provide the flow name, and click the Create button.
Step 2: Now we will create a List variable called Names, so, expand the variable section. Then drag and drop the Create new list action to Canvas and provide the below information:
- Now provide the new list name as Names, then click on Save.
Step 3: Next, we will add names to the list, for this, expand the variable section, then drag and drop the ‘Add item to list ‘ action to canvas. Then provide the below information:
- Add item: Provide the item name ‘Alex’.
- Into List: Click on the variable icon {x} -> select Names, then click Save.
Similarly, add the other items/names to the list of Names; next, we will fetch the first item from the list. So here I have added two more names to the list i.e. Ron and John.
Step 4: Now we will get the last item from the list, so expand the Message box section and then drag and drop the Display Message action to the canvas. Then provide the below information:
- Message box title: Provide the title like below.
- Message to display: Provide the below code as a message to display.
%Names[2]%
Step 5: Now run the flow by clicking on the run button, and you can see the message box will pop up with the first item in the list.
This is how we can get the last item from a list in Power Automate Desktop.
Conclusion
In this Power Automate Desktop, we saw how to get an item from a list using Power Automate Desktop. I have also explained how to get specific items from a list using Power Automate desktop.
You may like the following Power Automate desktop tutorials:
- Loop actions in Power Automate Desktop
- Power Automate desktop concatenate strings
- Power Automate Desktop Mathematical Operations
- Get items from SharePoint List using Power Automate Desktop
- Update Items in a SharePoint List in Power Automate Desktop
- Argument ‘Body’ must be ‘Binary’ – Power Automate Desktop
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com