繁体   English   中英

如何指向 Sharepoint excel 文件并从中提取数据

[英]How to point to and extract data from Sharepoint excel file

我有一个 excel 文件存储在 Sharepoint 中。 我将如何使用 python 指向此文件,以便我可以操作和处理其中的 excel 文件。

这就是我正在做的

from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File

url = 'https://yoursharepointsite.com/sites/documentsite'
username = 'yourusername'
password = 'yourpassword'
relative_url = '/sites/documentsite/Documents/filename.xlsx'


import openpyxl
import xlwings as xw


#workbook using xlwings
wls = xw.Book('wls_.xlsm')

但是,当我输入:

relative_url 

对于 jupyter 笔记本,我得到的 output 是:

'/sites/documentsite/Documents/filename.xlsx'

期望的

excel文件的实际output数据

但是,output 没有向我显示此文件的数据。 我不确定我做错了什么。 任何建议表示赞赏

好吧,是的,您还没有导入数据,当您在笔记本中键入您定义的变量时,它会返回该变量。 在这种情况下,它是您要读取的文件的字符串位置。

您将需要 pd.read_excel() 该文件以使其导入数据。

这是一个帮助您入门的链接: https://pandas.pydata.org/docs/reference/api/pandas.read_excel.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM