kkumar
kkumar

Reputation: 203

Read excel files from a remote server using pandas

I have a set of excel files sitting in a directory on a windows server. I am trying to read them using pandas but running into an error. I checked other similar posts but couldn't reach a solution so far. Code below has been referred from How to read an excel file directly from a Server with Python

I am trying to read the files from jupyter notebook installed on a linux server. I am able to ping the windows server from the linux box.

Here is my code:

import pandas
f = pandas.read_excel(open('//10.xx.xx.xx/directory1/directory2/TestDoc.xlsx','rb'))

Error:

IOError: [Errno 2] No such file or directory: 
'//10.xx.xx.xx/directory1/directory2/TestDoc.xlsx'

Can someone please help?

Thanks in advance!

EDIT 1:

Also tried without the keyword 'open' but still got the same error.

Upvotes: 0

Views: 4736

Answers (1)

Sascha Gottfried
Sascha Gottfried

Reputation: 3329

The code samples you are refering to show how to access network drives or UNC paths with Python running on Windows machines. Using a linux host you might need to mount the remote share with valid credentials and then pass a valid path on local file system to pandas.read_excel. Please pay close attention to this related question.

You might explore other ways to connect to SMB share with smb://.

Upvotes: 2

Related Questions