Read an excel file from sharepoint using python

G, Bhagyalaxmi 6 Reputation points
2022-01-06T07:31:55.383+00:00

Hi!
Can someone help with reading and downloading the excel file present in company's SharePoint location via python. I am generating Bearer token using client id, secret key but while using the same bearer token to download the excel file getting a 401 Unauthorized issue.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,824 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 36,171 Reputation points Microsoft Vendor
    2022-01-06T08:49:04.793+00:00

    Hi @G, Bhagyalaxmi ,
    Since the code is about python. It's out of our support scope. So we are unable to test the code for you. In this case, 401 Unauthorized often caused by the client id do not have enough permission.
    Please refer to the following document to register the app only
    https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs
    The scope of the App's Permission Request XML should refer to the following document
    https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/add-in-permissions-in-sharepoint
    Then you can generating Bearer token using client id, secret and run the code again


    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.



Your answer

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