How to count rows in a SharePoint list using Power Automate?

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:

How to count rows in SharePoint list using Power Automate

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
count rows in SharePoint list using flow

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'])
count rows in SharePoint list using flow example

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.
count rows in SharePoint list using Microsoft flow

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.

count rows in SharePoint list using the Microsoft flow

Here in our Employee SharePoint List has five list items.

How to count rows in SharePoint list using the Power Automate

We can see the email in Outlook, which displays the SharePoint list rows count value.

How to count rows in SharePoint list using the Power Automate flow

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.

Example to count rows in SharePoint list using Power Automate flow

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
count rows in SharePoint list using the Power Automate flow

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']
Example to count rows in SharePoint list using Power Automate

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.
count rows in SharePoint list using Power Automate flow

Save and Run the flow by clicking the Run flow option. Once the flow ran successfully like below.

count rows in SharePoint list using Power Automate

In our Task List, we have Six list items.

count rows in the SharePoint list using Power Automate flow

We can see the email in Outlook, which displays the SharePoint list rows count value.

How to count rows in SharePoint list using Power Automate flow

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:

>