I am trying to read the excel file that I stored in Sharepoint. But I wasn't able to. I have referred to most of the existing articles but that didn't solve my issue.
Code I referenced From: How to read SharePoint Online (Office365) Excel files in Python with Work or School Account?
Read xlsx stored on sharepoint location with openpyxl in python?
But no luck.
import io
import json
import pandas as pd
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.runtime.auth.user_credential import UserCredential
from office365.runtime.http.request_options import RequestOptions
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File
from io import BytesIO
username = '##########################'
password = '##########################'
site_url = "#######################################################"
ctx = ClientContext(site_url).with_credentials(UserCredential(username, password))
request = RequestOptions("{0}/_api/web/".format(site_url))
response = ctx.execute_request_direct(request)
json_data = json.loads(response.content)