Created
March 16, 2019 17:20
-
-
Save dkatz23238/185f5b15294e7bea1f31233f82b66e13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import BytesIO | |
import requests | |
from pandas import read_csv | |
def pandas_read_gsheets(GSHEET_ID): | |
''' Returns a pandas DataFrame from a spreadsheet in google sheets. Make sure the spreadsheet has a "view" link and only contains one tab of data.''' | |
r = requests.get('https://docs.google.com/spreadsheets/d/%s/export?format=csv' % GSHEET_ID) | |
data = r.content | |
df = read_csv(BytesIO(data)) | |
return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment