由于某些原因,我无法导入office365.sharepoint.file

2024-06-16 10:05:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试导入office365.sharepoint.file,但不断收到错误

ModuleNotFoundError:没有名为“office365.sharepoint.file”的模块

我被卡住了,因为我无法确定用于导入它的方法是否已更改

任何帮助都将不胜感激

import io
from office365.sharepoint.file import File 

response = File.open_binary(ctx, relative_url)

#save data to BytesIO stream
bytes_file_obj = io.BytesIO()
bytes_file_obj.write(response.content)
bytes_file_obj.seek(0) #set file object to start

#read file into pandas dataframe
df = pd.read_excel(bytes_file_obj)```


---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-9-ce2948d5390a> in <module>
      1 import pandas as pd
      2 import io
----> 3 from office365.sharepoint.file import File
      4 
      5 response = File.open_binary(ctx, relative_url)

ModuleNotFoundError: No module named 'office365.sharepoint.file'```

Tags: fromioimportobjbytesresponseopenfile