我想从sharepoint下载excel文件(一个特定的工作表),并将其作为数据框使用。我正在使用python并尝试了以下代码:
import requests
from requests_ntlm import HttpNtlmAuth
url = 'http://sbg.wistron.com/_layouts/15/WopiFrame.aspx?sourcedoc=/Astro%20EMEA%20OMEGA/01.%20SPF%20Materials%20-%20Lucie%20Souckova/SPF%20Phase%20Part%20list/Astro%20SPF%20Phase%20Part%20list%20for%20CZ%2020170616.xlsx'
username = 'aaa@bbb.com'
password = 'ccc*'
import io
import pandas as pd
urlData = requests.get(url, auth=HttpNtlmAuth(username,password)).content
rawData = pd.read_excel(io.StringIO(urlData.decode('utf-8')), sheet_name = 'SMS SPF Parts list')
在此之后
`Traceback (most recent call last):
File "D:\Python\Python37-32\lib\site-packages\IPython\core\interactiveshell.py", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-21-2e8e23428324>", line 12, in <module>
rawData = pd.read_excel(io.StringIO(urlData.decode('utf-8')), sheet_name = 'SMS SPF Parts list')
File "D:\Python\Python37-32\lib\site-packages\pandas\util\_decorators.py", line 188, in wrapper
return func(*args, **kwargs)
File "D:\Python\Python37-32\lib\site-packages\pandas\util\_decorators.py", line 188, in wrapper
return func(*args, **kwargs)
File "D:\Python\Python37-32\lib\site-packages\pandas\io\excel.py", line 350, in read_excel
io = ExcelFile(io, engine=engine)
File "D:\Python\Python37-32\lib\site-packages\pandas\io\excel.py", line 653, in __init__
self._reader = self._engines[engine](self._io)
File "D:\Python\Python37-32\lib\site-packages\pandas\io\excel.py", line 422, in __init__
self.book = xlrd.open_workbook(file_contents=data)
File "D:\Python\Python37-32\lib\site-packages\xlrd\__init__.py", line 110, in open_workbook
filename = os.path.expanduser(filename)
File "D:\Python\Python37-32\lib\ntpath.py", line 291, in expanduser
path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType`
您知道如何解决此问题吗?
谢谢