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
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))
7 Comments
Mariano
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
min2bro
Can i get access to the sample file and then i can try from my end?
Mariano
sure, here is the link='thi-my.sharepoint.com/personal/mariano_scandizzo_spartners_me/…'
min2bro
Access to this link has been removed, Sorry
Mariano
sorry for that , the following one should work thi-my.sharepoint.com/personal/mariano_scandizzo_spartners_me/… thank you for all your help
|