1

I use to upload excel files into pandas dataframe pd.ExcelFile if the files are in my local drive How can I do the same if I have an Excel file in Google Drive or Microsoft One Drive and I want to connect remotely?

1 Answer 1

1

You can use read_csv() on a StringIO object:

from StringIO import StringIO  # moved to io in python3.

import requests
r = requests.get('Your google drive link')
data = r.content

df = pd.read_csv(StringIO(data))
Sign up to request clarification or add additional context in comments.

7 Comments

I tried your idea but it did not work I am getting the following error "TypeError: initial_value must be str or None, not bytes" I also tried with BytesIO in case that the problem was there
Can i get access to the sample file and then i can try from my end?
Access to this link has been removed, Sorry
sorry for that , the following one should work thi-my.sharepoint.com/personal/mariano_scandizzo_spartners_me/… thank you for all your help
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.