小编Bik*_*rth的帖子

通过 Google Sheets API 和 Python 读取 Sheet2

我只想通过我的 Google Sheets 项目中的 API 使用 Python (Windows 10) 读取下一个选项卡/工作表 一切都适用于工作表 1,我只想阅读/编辑工作表 2(以及我将在项目中创建的其他工作表)。

选项卡示例:https://i.stack.imgur.com/d4Ee9.jpg

import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_penny.json', scope)
client = gspread.authorize(creds)

penny = client.open('pennystocks').sheet1

print(penny.get_all_records())
Run Code Online (Sandbox Code Playgroud)

这有效: penny = client.open('pennystocks').sheet1

这不是: penny = client.open('pennystocks').sheet2

python google-api

2
推荐指数
1
解决办法
2911
查看次数

标签 统计

google-api ×1

python ×1