Access Google spreadsheet on Google Colaboratory (Jupyter notebook)

Loading data from Google Sheets is covered in the I/O example notebook: https://colab.research.google.com/notebook#fileId=/v2/external/notebooks/io.ipynb&scrollTo=sOm9PFrT8mGG


!pip install --upgrade -q gspread

import gspread
import pandas as pd
from google.colab import auth
from oauth2client.client import GoogleCredentials

auth.authenticate_user()
gc = gspread.authorize(GoogleCredentials.get_application_default())

worksheet = gc.open('data_set.csv').sheet1
rows = worksheet.get_all_values()
pd.DataFrame.from_records(rows)