PythongSheets,当试图从单元格中获取输出时,它给了我一个非常大的字符串,这就是我们

2024-06-16 12:31:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在为将来的一些程序制作一个小数据库,我正在测试gsheets,我想制作一个简单的计数器,除了一个单元格给我的输出,一切都很顺利

它输出"Cell R1C1 '2'",我不知道如何将其转换为实际使用的变量

import gspread
from oauth2client.service_account import ServiceAccountCredentials

scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']

credentials = ServiceAccountCredentials.from_json_keyfile_name('My Project-b417d3513158.json', scope)

client = gspread.authorize(credentials)

sheet = client.open('Database').sheet1

result = sheet.cell(1,1)

print(result)

Tags: fromhttpsimport程序comclient数据库json