Python 是否可以使用gspread查询单元格注释和颜色?

Python 是否可以使用gspread查询单元格注释和颜色?,python,google-sheets,google-spreadsheet-api,gdata,gspread,Python,Google Sheets,Google Spreadsheet Api,Gdata,Gspread,我正在尝试学习Python和这个GoogleAPI,我想知道单元格注释和颜色是可以在gspread中查询还是以其他形式查询?如果是这样,请有人给我指出正确的方向或文档 到目前为止,我已经发现了两件看起来很有帮助的事情,但我真的不知道如何将它们应用到Python中,或者仅仅是使用什么 我认为,如果您首先了解Python如何与Google电子表格一起工作,将会很有帮助。 以下是电子表格的详细信息。 确保您还安装了 有一种可能对你有用的方法。它返回范围内左上角单元格的背景色(即“#ffffff”)。

我正在尝试学习Python和这个GoogleAPI,我想知道单元格注释和颜色是可以在gspread中查询还是以其他形式查询?如果是这样,请有人给我指出正确的方向或文档

到目前为止,我已经发现了两件看起来很有帮助的事情,但我真的不知道如何将它们应用到Python中,或者仅仅是使用什么


我认为,如果您首先了解Python如何与Google电子表格一起工作,将会很有帮助。 以下是电子表格的详细信息。 确保您还安装了

有一种可能对你有用的方法。它返回范围内左上角单元格的背景色(即“#ffffff”)。不过,请尝试在Python中找到等效项

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];

var cell = sheet.getRange("B5");
Logger.log(cell.getBackground());

希望这能有所帮助。

我认为,如果您首先了解Python如何与Google电子表格一起工作,这会很有帮助。 以下是电子表格的详细信息。 确保您还安装了

有一种可能对你有用的方法。它返回范围内左上角单元格的背景色(即“#ffffff”)。不过,请尝试在Python中找到等效项

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];

var cell = sheet.getRange("B5");
Logger.log(cell.getBackground());

希望这能有所帮助。

如果您关注了GitHub问题的链接,您会发现在GSpread 3.7中设置注释已得到解决,但忽略了获取(或者我太密集而找不到它)。因为我需要它,所以我使用Google
服务
对象编写了自己的代码。假设您已设置服务帐户凭据(与
gspread
相同),请创建
服务

从oauth2client.service\u帐户导入ServiceAccountCredentials
从GoogleAppClient导入发现
范围=['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds=ServiceAccountCredentials.from_json_keyfile_name(文件名,作用域)
service=discovery.build('sheets','v4',credentials=creds)
使用
service
和电子表格
id
获取注释:

fields='sheets/data/rowData/values/note'
范围=[“'Sheet1'!A1”)]
request=service.spreadsheets().get(spreadsheetId='1idmqqav5t4rqblahblah',ranges=ranges,fields=fields)
注意_json=request.execute()
尝试:

note=note_json['sheets'][0]['data'][0]['rowData'][0]['values'][0]['note'].\35;如果您关注了GitHub问题的链接,您会发现在GSpread 3.7中设置了一个注释,但是忽略了获取(或者我太密集了,找不到它)。因为我需要它,所以我使用Google
服务
对象编写了自己的代码。假设您已设置服务帐户凭据(与
gspread
相同),请创建
服务

从oauth2client.service\u帐户导入ServiceAccountCredentials
从GoogleAppClient导入发现
范围=['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds=ServiceAccountCredentials.from_json_keyfile_name(文件名,作用域)
service=discovery.build('sheets','v4',credentials=creds)
使用
service
和电子表格
id
获取注释:

fields='sheets/data/rowData/values/note'
范围=[“'Sheet1'!A1”)]
request=service.spreadsheets().get(spreadsheetId='1idmqqav5t4rqblahblah',ranges=ranges,fields=fields)
注意_json=request.execute()
尝试:

note=note_json['sheets'][0]['data'][0]['rowData'][0]['values'][0]['note'].#您好,感谢您的回复。我的理解是,提供的链接是针对Gdata的,它是GoogleSheetsV3,查看GoogleSheetsV4(发现服务API)?这或多或少是正确的吗?我不知道这意味着什么,这意味着你仍然可以使用这个gdata库,还是需要安装其他东西?嗨,谢谢你的回复。我的理解是,提供的链接是针对Gdata的,它是GoogleSheetsV3,查看GoogleSheetsV4(发现服务API)?这或多或少是正确的吗?我不知道这意味着什么,这意味着你仍然可以使用这个gdata库,还是需要安装其他东西?