How to read an excel file directly from a Server with Python

喜夏-厌秋 提交于 2019-12-02 10:48:21

You need to open the file as rb mode

b = bynary file r = only read the file

f = open('//X/str/Db/C/Source/selection/Date/Test/12.xlsx', 'rb')

You can use pandas library that will do most of the work for you

import pandas

import pandas
f = pandas.read_excel(open('//X/str/Db/C/Source/selection/Date/Test/12.xlsx','rb'), sheetname='Sheet 1')
# or using sheet index starting 0
f = pandas.read_excel(open('//X/str/Db/C/Source/selection/Date/Test/12.xlsx','rb'), sheetname=2)

There is a similar question here

I had same issue. Try Pandas and forward slashes

pd.read_excel('//X/str/Db/C/Source/selection/Date/Test/12.xlsx') 

Have to work perfectly

From here.

Try using forward slashes in your UNC path:

f = open('//X/str/Db/C/Source/selection/Date/Test/12.xlsx', 'rb')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!