Share via

Accessing SharePoint Excel File Without Syncing

Anonymous
2025-07-10T09:47:39.0066667+00:00

How can an Excel file on a SharePoint site be accessed and read from a PC without using the sync option? An Azure AD app registration has been created with Sites.Selected permission, and a client certificate along with another uploaded certificate has been set up. A Python script utilizing the 'Office365-REST-Python-Client' library is being used to read the file, but a connection 401 error is encountered. What are the steps to troubleshoot and resolve this issue?

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments

Answer accepted by question author

Steven-N 25,305 Reputation points Microsoft External Staff Moderator
2025-07-10T12:06:21.7033333+00:00

Hi Ahmed Badawi

Thanks for reaching out to Microsoft Q&A forum support.

Based on your description, I understand you're encountering a 401 Unauthorized error when trying to access an Excel file hosted on a SharePoint site using the Office365-REST-Python-Client library in Python. This occurs despite having set up an Azure AD app registration with the Sites.Selected permission and configured client certificates. 

As a forum moderator, I may not be able to provide a definitive solution due to limitations in available resources and access to your specific environment. However, I’ve conducted some research on this issue. 

This problem has been raised by other users across various technical communities such as:

Github: 401 Client Error: Unauthorized · Issue #314 · vgrem/office365-rest-python-client 

StackOverflow: Python Sharepoint library Office365-REST-Python-Client ERROR: 401: Unauthorized for url: https://mydomain.sharepoint.com/sites/sample/_api/Web - Stack Overflow

And it seems that the most feasible solution to this problem is: 

Step 1:  Install cmdlet if you don't have it  

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

Step 2: Connect and run the command

Connect-SPOService -Url https://[tenant]-admin.sharepoint.com -Credential ******@domain.com
Set-SPOTenant -DisableCustomAppAuthentication $false

Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link 

That said, you can try the approach I suggested above to see if the problem persists and you can read more insight from given links, but please note that this is an unofficial approach from Microsoft. 

Hope you will solve your problem soon  


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".    

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.