To count the rows in a SharePoint list with Power Automate, use Get items and wrap its output in length(), or read the list’s ItemCount property with Send an HTTP request to SharePoint. The first method can also count only the rows that match a filter, and the second is the fastest on big lists.
I use these counts all the time: a daily email that says how many orders are still open, a condition that stops a flow when a list is empty, or a number posted to Teams. In this tutorial, I’ll build all three methods on a Contoso Customer Orders list, show where the count silently goes wrong at 100 and 5,000 items, and explain how to fix it.
Quick answer: Add Get items, turn on Pagination in its Settings, and use a Compose with length(body('Get_items')?['value']). For a fast total on any list size, use Send an HTTP request to SharePoint with the Uri _api/web/lists/getbytitle('Customer Orders')/ItemCount and the header Accept: application/json;odata=nometadata, then read body('Send_an_HTTP_request_to_SharePoint')?['value'].
Which method should you use?
All three methods return a whole number that you can use in a condition, an email or a variable. Pick the one that matches what you need to count. If the flow also reads the items, the Get items method costs you nothing extra, because you use the Get items filter query anyway.
| Method | Best for | Watch out for |
|---|---|---|
| Get items + length() | Small and medium lists, or when you need the items too | 100 items by default; 5,000 or 100,000 with pagination, depending on your license |
| REST ItemCount | The total of any list, even 100,000+ items | Can’t filter; counts folders too |
| Get items with a Filter Query + length() | Rows that match a condition (Status, date, region) | Same limits as Get items; index the filtered column on big lists |
Method 1: Count list rows with Get items and length()
My sample list, Customer Orders, has 15 orders with Title, Customer Name, Order Date, Status, Region and Amount columns. Here’s the flow:
- In Power Automate, select Create > Instant cloud flow, name it, choose Manually trigger a flow, and select Create.
- Select + > Add an action, search for Get items, and pick the SharePoint action. Choose your Site Address and List Name.
- Add a Compose action and rename it Total items. In Inputs, select the fx button and enter the expression below.
length(body('Get_items')?['value'])
![power automate length get items code view Power Automate Code view of the Total items Compose action showing the expression @length(body('Get_items')?['value'])](https://www.enjoysharepoint.com/wp-content/uploads/2026/10/power-automate-length-get-items-code-view.png)
Get items returns its rows in an array called value, and length() counts the elements of an array. If your action has a different name, such as Get orders, the expression uses that name with underscores: body('Get_orders')?['value'].
You’ll also see outputs('Get_items')?['body/value'] in other examples. It returns the same array, so both expressions give the same count. For more on the function itself, see how the length function works in Power Automate.
Turn on pagination, or the count stops at 100
This is the mistake I see most often. By default, Get items returns only the first 100 items, so length() says 100 even when the list has 2,000 rows. There’s no error, just a wrong number.
To fix it, select the Get items action, open the Settings tab, and under Networking turn on Pagination. Then enter a Threshold that’s higher than the number of items you expect, for example 5000.

The threshold has a ceiling that depends on your license: 5,000 items for the Low performance profile, which includes flows that run on Microsoft 365 plans, and 100,000 for premium plans. For the details, see how to get more than 100 items with Get items.
Here’s what that looks like on a bigger list. On a list with 11,152 items and the threshold at 5000, Get items took 1 minute 26 seconds and the count came back as exactly 5,000:

A round 5,000 (or 100,000) is a warning sign: it’s the limit, not the real count. You can also set Top Count under Advanced parameters to 5000, the maximum for one page; with pagination on, the action then fetches fewer, bigger pages, which is faster.
Test the flow
Select Save, then Test > Manually > Test > Run flow. When the run finishes, select the Compose action to see the count in Outputs. My Customer Orders list returned 15.
When you save, the Flow checker may warn that Get items doesn’t have a filter query or top parameter. That’s only a performance tip. The flow still runs.
Method 2: Get the total with the REST ItemCount property
Every SharePoint list stores its own item count. Reading it is one small request instead of downloading every row, so it takes about a second whether the list has 15 or 150,000 items.
- Add Send an HTTP request to SharePoint and select the same Site Address.
- Set Method to GET and Uri to
_api/web/lists/getbytitle('Customer Orders')/ItemCount. Use your list’s display name. - Under Advanced parameters, add a header with the key
Acceptand the valueapplication/json;odata=nometadata. - Add a Compose named List item count with the expression below.

body('Send_an_HTTP_request_to_SharePoint')?['value']
With the nometadata header, SharePoint answers with a tiny JSON object such as {"value": 15}, so the count is in value. Some tutorials read ['d']['ItemCount'] instead. That path only works with the odata=verbose header, so match the expression to the header you set.

Both methods returned 15 on my small list. On the 11,152-item list from earlier, where Get items stopped at 5,000, the REST call returned the real total in one second:

If the list name has an apostrophe, double it in the Uri, for example getbytitle('Megan''s Tasks'). If you get a “list does not exist” error, open /_api/web/lists after your site URL in the browser to see the exact list titles.
Keep two things in mind. ItemCount counts every item, including folders if the list has them. And because it’s the whole list, it can’t apply a filter. For that, use the next method.
Method 3: Count only the rows that match a filter
To count, for example, only the shipped orders, add a Filter Query to Get items and keep the same length() expression. In Get items, open Advanced parameters, choose Filter Query, and enter a condition. Some useful ones:
| Count rows where | Filter Query |
|---|---|
| Status is Shipped | Status eq ‘Shipped’ |
| Created after 01/01/2026 | Created ge ‘2026-01-01T00:00:00Z’ |
| Amount is over 500 | Amount gt 500 |
| Two conditions are true | Status eq ‘Shipped’ and Region eq ‘West’ |
| Only items, not folders | FSObjType eq 0 |
Use the column’s internal name, which you can see in the URL when you edit the column in list settings. A column created as “Order Status” has the internal name Order_x0020_Status. To combine more conditions, see filter queries with multiple conditions.
Relative dates work too. To count the orders from the last 30 days, I use OrderDate ge '@{getPastTime(30, 'Day', 'yyyy-MM-dd')}', which I explain in the getPastTime function tutorial.
Pagination still matters here. On a list with more than 5,000 items, Microsoft notes that a filtered Get items can return nothing if no match is in the first 5,000 rows, unless pagination is on. Indexing the filtered column in list settings helps too.
Use the count in your flow
A Compose is fine for testing, but in a real flow you usually do one of these:
- Store it: initialize an Integer variable with the count expression as its value, so later actions can update or compare it.
- Check for an empty list: add a Condition with the count is greater than 0, and put the rest of the flow in the True branch.
- Report it: put the count in a Send an email (V2) or Post message in a chat or channel action, for example “There are 7 open orders today.”
A few scenarios where I’ve used this pattern:
- Daily summary: a scheduled flow counts the open tasks in a project tracker every morning and emails the team.
- Escalation: if more than 50 approvals are pending, send a high-priority alert to the manager; otherwise send a routine digest.
- List health check: a weekly flow reads ItemCount on a large master list and alerts you if the number drops sharply, which can mean a bulk delete.
If you need counts per value, such as orders per region, filter once per value or group the rows with Select and Filter array. To work with each row after counting, see how to loop through SharePoint list items.
Troubleshooting
- The count is always 100: pagination is off. Turn it on in the Get items Settings and set a threshold.
- The count is always 5,000: you’ve hit the Top Count or the pagination limit of your license. Use the REST ItemCount method for the total.
- The flow returns 0: check the list name and site address, and make sure the flow’s connection has at least Read access to the list.
- InvalidTemplate error on the expression: the action name in the expression doesn’t match. Spaces become underscores, so Get items 2 is
Get_items_2. - The REST count is empty: check the Accept header. Without
odata=nometadata, the value is in a different place in the response. - ItemCount is higher than the rows you see: folders are counted too. Use Get items with
FSObjType eq 0to count only items. - A pasted expression fails: curly quotes from a website break expressions. Retype the single quotes in the expression editor.
These tutorials go well with counting list rows:
Frequently Asked Questions
Why does my Power Automate count stop at 100?
Get items returns 100 items by default. Turn on Pagination in the action’s Settings and set a threshold, as described in Microsoft’s Get items and Get files guidance.
Why does my count stop at 5,000?
That’s the pagination limit for flows on Microsoft 365 plans (100,000 on premium plans) and the maximum Top Count. Use the REST ItemCount call for the full total.
What is the fastest way to count rows in a large SharePoint list?
Use Send an HTTP request to SharePoint with _api/web/lists/getbytitle(‘List Name’)/ItemCount. It reads one number instead of every item.
How do I count only the rows that match a condition?
Add a Filter Query to Get items, such as Status eq ‘Shipped’, keep pagination on, and use length(body(‘Get_items’)?[‘value’]).
Does ItemCount include folders?
Yes. ItemCount counts every item in the list, folders included. To exclude folders, use Get items with FSObjType eq 0.
Can I count files in a document library the same way?
Yes. Use Get files (properties only) with length(), or call ItemCount on the library’s title, such as getbytitle(‘Documents’).

I have worked with Microsoft technologies for more than 18 years, including SharePoint, Microsoft 365 and the Power Platform (Power Apps, Power Automate and Power BI), at companies like HP, TCS and KPIT. I started EnjoySharePoint in 2011 to share the solutions I build in real projects with readers in the United States, Canada, the United Kingdom, Australia, New Zealand and beyond. Microsoft has recognized this work with the Microsoft MVP award 13 times since 2014.