我对这些东西很陌生,而且我在我的早期项目中真的遇到了麻烦。
我已经尽最大努力到处寻找,包括 - 搜索引擎、StackOverflow、API 文档,但我真的找不到任何地方的答案。所以我希望提问是合适的。
我正在尝试从 Google 工作表的特定工作表(底部的标签)查看范围。我知道这张表有一个可以在 url 中找到的 sheetId。我可以得到这个,但是,我绝对找不到使用此编号请求特定工作表的方法。我找到了使用这个数字来复制和复制工作表的方法,我什至找到了一种在电子表格上打印所有可用 sheetId 的方法。
def suggestion():
SAMPLE_SPREADSHEET_ID = 'mySpreadsheetID'
SAMPLE_RANGE_NAME = 'A1:D12'
"""Shows basic usage of the Sheets API.
Prints values from a sample spreadsheet.
"""
# The file token.json stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
store = file.Storage('token.json')
creds = store.get()
if not creds or creds.invalid:
flow = client.flow_from_clientsecrets('creds.json', SCOPES)
creds = tools.run_flow(flow, store) …Run Code Online (Sandbox Code Playgroud)