Mariano
Mariano

Reputation: 395

How to upload Cloud files into Python

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?

Upvotes: 1

Views: 80

Answers (1)

min2bro
min2bro

Reputation: 4638

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))

Upvotes: 1

Related Questions