This Power Automate tutorial helps you count rows in a SharePoint list using Power Automate and what are the different ways we can achieve it using Power Automate flow with examples.
Scenario:
The flow triggers manually, and there are two ways to count rows in a SharePoint list using Power Automate. They are,
- Using the Get Items action
- Using Rest API
Follow the examples below to clearly understand how to count rows in a SharePoint list using Power Automate. Finally, we will send an email to the user that the Particular list contains with row count value.
Count rows in a SharePoint list using Power Automate
Let us see how to count rows in a SharePoint list using the Power Automate flow
Here we will use the below Employeelist:
Example :1 (Using the Get Items action)
We can use the Get Items flow action to count number of rows presented in a SharePoint Online list.
- Login to Power Automate, and create an instant cloud flow. Select + new step and choose the Get items action from the action triggers.
- Configure the SharePoint site address and List Name. Here my List Name is EmployeeList
Add a compose action, and pass the below expression as an input to calculate the rows in the SharePoint list.
length(outputs('Get_items')?['body/value'])
Select +new step and send email action, Then Provide the parameters such as:
- To- Set the user from the dynamic content
- Subject- Employee List Row Count.
- Body- Specify the body and Pass the output of the compose action from dynamic content value.
Save and Run the flow by selecting the Run flow option. Once the flow ran successfully like below. The user will receive an email displaying the SharePoint list rows count value.
Here in our Employee SharePoint List has five list items.
We can see the email in Outlook, which displays the SharePoint list rows count value.
Using the Power Automate flow, this is one way to count rows in the SharePoint list.
Example:2 (Using Rest API)
We can also use the Rest API to count rows in a SharePoint list in Power Automate.
In this example, we will use the below TaskList.
Create an instant cloud flow. Add an action ‘Send an HTTP request to SharePoint‘ from action triggers and provide the SharePoint site address.
- Method- GET
- Uri- /_api/web/lists/getbytitle(‘TaskList’)/ItemCount
- Headers-
- Accept – application/json;odata=verbose
- content-type – application/json;odata=verbose
Add a compose action, and pass the below expression as an input to calculate the rows in the SharePoint list.
body('Send_an_HTTP_request_to_SharePoint')?['d']?['ItemCount']
Select +new step and send email action, Then Provide the parameters such as:
- To- Set the user from the dynamic content
- Subject- Task List Row Count.
- Body- Specify the body and Pass the output of the compose action from dynamic content value.
Save and Run the flow by clicking the Run flow option. Once the flow ran successfully like below.
In our Task List, we have Six list items.
We can see the email in Outlook, which displays the SharePoint list rows count value.
This is another way to count rows in the SharePoint list using the Power Automate flow.
This is how to count rows in the SharePoint list using the Power Automate flow.
Conclusion
In this Power Automate tutorial, we learned how to use Power Automate to count rows in a SharePoint list. We saw here, two different ways to count rows in a SharePoint list using Power Automate.
You may also like:
- How to Check if a field exists in Power Automate?
- Power Automate Filter Query If Blank
- How to Create XML file from CSV in Power Automate?
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.