How to get analytics of a SharePoint file via email report?

New Contributor

Hi Community,

We have a specific requirement where we need to get detailed analytics of a particular excel file hosted on our SharePoint Online site over email every day. We would like to get the number of views and usernames for the file.

We would like to know if there is a way to achieve this using the SharePoint inbuilt feature or using a script + SharePoint/Graph API. We would also like to mention that the report needs to be in a specific format, and we have some security constraints.

Is there anyone who has done this before and could guide us on how to achieve this?

Thank you in advance for your help!

2 Replies
best response confirmed by Ukhan (New Contributor)

@Ukhan I had the same question couple of months ago :smile:
I went through this article and set this up with Azure App registration it's working perfect since you have access to more resources in Graph.
Check this:


Review this and let me know if you have any questions. 

Thanks Jennifer,

I followed all the steps from above article you shared.
I am getting python dependency errors. I created requirements.txt but it doesn't seem to be working. I am runing script in
Here is the error screen
here is requirements.txt
Any help would be highly appreciated