Count Number of Attachments

Brass Contributor

I would like a column to count the number of attachements on an item. Something like this:



I then need to change the cell colour to Red if below a particular number and Green if it hits the number.

1 Reply



Unfortunately, you cannot count the number of attachments added to SharePoint list item using calculated column formulas.


Calculated columns does not support the use of attachments column in the formulas.


Also, it is not possible to read the number of attachments added to SharePoint list item using SharePoint JSON formatting. More information at: How can I add a link to list attachments using SharePoint JSON formatting 


Available options to count the number of attachments:

  1. Develop SPFx Field customizer extensions solution to get the count of list item attachments. You can refer this SPFx sample to get started: React Field Attachment Info 
  2. Use Power automate flow to get the list item attachments using Get attachments action and then update the list column accordingly. You can run this flow as automated flow (when item created/modified) or scheduled flow (daily or 2 times a day, etc.) as per your requirements.

Available options to change the cell color:

  1. Once you have the count of item attachments in the list column, you can easily color code it using JSON formatting.
  2. SPFx field customizer: If you are developing field customizer solution for getting the count of list item attachments, you can color code the cell using field customizer as you have full control of UI using custom code.

Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.