嗨,我正在使用Google Colaboratory(类似于 Jupyter Notebook)。有谁知道如何使用 Google Colaboratory notebook 从 Google Sheets 访问数据?
问问题
16907 次
2 回答
8
I/O 示例笔记本中介绍了从 Google 表格加载数据: https ://colab.research.google.com/notebook#fileId=/v2/external/notebooks/io.ipynb&scrollTo=sOm9PFrT8mGG
于 2018-01-26T23:52:55.600 回答
2
!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)
于 2019-06-03T11:47:43.287 回答