[英]Access Google Sheets on Google Colaboratory
Hi I am using Google Colaboratory (similar to Jupyter Notebook).嗨,我正在使用Google Colaboratory (类似于 Jupyter Notebook)。 Does anyone know how to access data from Google Sheets using Google Colaboratory notebook?
有谁知道如何使用 Google Colaboratory 笔记本访问 Google Sheets 中的数据?
I/O 示例笔记本介绍了从 Google 表格加载数据: 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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.