我正在尝试使用python将excel文件从我的工作SharePoint站点下载到本地文件夹。我已经编写了一个代码来成功地在sharepoint中进行身份验证现场。但是从sharepoint文档库下载Excel文件时需要帮助。我是Python新手,非常感谢您的帮助:) 以下是我的代码:
import urllib.request
import requests
from requests_ntlm import HttpNtlmAuth
def sharepointlogin():
site = "https://abc.sharepoint.com/site"
username = "*******"
password = "*******"
response = requests.get(site, auth=HttpNtlmAuth(username, password))
print(response.status_code)
def filedownload():
print('Downloading file')
url = 'https://abc.sharepoint.com'
urllib.request.urlretrieve(url, 'C:\Downloads\filename.xlsx')
print("File Downloaded")
print("Download complete")
sharepointlogin()
filedownload()
一个快速的google找到了这个例子https://www.example-code.com/python/sharepoint_download_file.asp
另一个例子是最近问的Download SharePoint file using Python
相关问题 更多 >
编程相关推荐