0

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.

kkumar
  • 173
  • 2
  • 5
  • 15

1 Answers1

2

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://.

Sascha Gottfried
  • 3,303
  • 20
  • 30
  • Thank you! Jupyter notebooks I am using are on our hadoop cluster- just wanted to check if I can read the files from the remote server using spark instead of moving them/mounting the remote share. Unfortunately, I am not allowed to mount the remote share/move the files. Just trying to see if there are any other options. – kkumar Mar 06 '19 at 15:50