与之前没有完全回答的问题类似,我正在尝试使用Python3和Sharepy下载一个here文件,使用pandas对其进行操作,然后将其重新上传回sharepoint。
问题可能是,我不知道真正的excel文件存储在哪里,我只有一个引用链接,可以分享给其他有访问权限的人。下载该链接是指向Excel Online的html,而不是我想要的Excel文件。有什么建议吗?
import sharepy
from sharepy import connect
from sharepy import SharePointSession
server='https://mycompany365.sharepoint.com'
user='first.m.last@mycompany.com'
password='1234Password1234'
# Copy/Paste file link from sharepoint below. #<--- partially works
site = "https://mycompany.sharepoint.com/:x:/r/sites/Sales/Shared%20Documents/General/My_File.xlsx?d=wb182f80code74bd586b225codebeb1c&csf=1&e=CodeeT"
s = sharepy.connect(server,user,password)
# Download file to same folder as python script, save as My_File.xlsx.
r = s.getfile(site,\
filename = 'My_File.xlsx')
print("Script Complete")
My site =会导致html指向正确的联机文件,而不是真正的Excel文件。我怎样才能找到真正的文件呢?
发布于 2019-06-10 01:14:23
在使用了一些暴力手段之后,我发现删除“分享链接”末尾的随机代码会打开原始文件:
# Copy/Paste file link from sharepoint below. Before...
site = "https://mycompany.sharepoint.com/:x:/r/sites/Sales/Shared%20Documents/General/My_File.xlsx?d=wb182f80code74bd586b225codebeb1c&csf=1&e=CodeeT"
# Copy/Paste file link from sharepoint below. After.
site = "https://mycompany.sharepoint.com/:x:/r/sites/Sales/Shared%20Documents/General/My_File.xlsx"
https://stackoverflow.com/questions/56494016
复制相似问题