Google 张 APIv4:从单元格获取笔记
Google sheets APIv4: Getting notes from cell
我找不到从单元格中检索笔记的方法。我看了这里:https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/get
我可以使用此处的代码更新注释:https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells
...但是我一开始就找不到检索笔记的方法。
这是 values.get
调用具有注释的单元格的结果...
{u'range': u'Sheet1!D5', u'values': [[u'update CD data']], u'majorDimension': u'ROWS'}
如您所见,单元格的注释不存在。
如何对字段使用 sheets/data/rowData/values/note
?
终点如下
GET https://sheets.googleapis.com/v4/spreadsheets/### Spreadsheet ID ###?fields=sheets%2Fdata%2FrowData%2Fvalues%2Fnote
根据你的个人资料,如果你使用 Python,这个怎么样?
response = service.spreadsheets().get(spreadsheetId=id, fields="sheets/data/rowData/values/note").execute()
结果:
当"A1:B2"处有注释时,结果如下
{
"sheets": [
{
"data": [
{
"rowData": [
{
"values": [
{
"note": "sample note A1"
},
{
"note": "sample note B1"
}
]
},
{
"values": [
{
"note": "sample note A2"
},
{
"note": "sample note B2"
}
]
}
]
}
]
}
]
}
参考:
如果我误解了你的问题,请告诉我。我想修改一下。
我找不到从单元格中检索笔记的方法。我看了这里:https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/get
我可以使用此处的代码更新注释:https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells
...但是我一开始就找不到检索笔记的方法。
这是 values.get
调用具有注释的单元格的结果...
{u'range': u'Sheet1!D5', u'values': [[u'update CD data']], u'majorDimension': u'ROWS'}
如您所见,单元格的注释不存在。
如何对字段使用 sheets/data/rowData/values/note
?
终点如下
GET https://sheets.googleapis.com/v4/spreadsheets/### Spreadsheet ID ###?fields=sheets%2Fdata%2FrowData%2Fvalues%2Fnote
根据你的个人资料,如果你使用 Python,这个怎么样?
response = service.spreadsheets().get(spreadsheetId=id, fields="sheets/data/rowData/values/note").execute()
结果:
当"A1:B2"处有注释时,结果如下
{
"sheets": [
{
"data": [
{
"rowData": [
{
"values": [
{
"note": "sample note A1"
},
{
"note": "sample note B1"
}
]
},
{
"values": [
{
"note": "sample note A2"
},
{
"note": "sample note B2"
}
]
}
]
}
]
}
]
}
参考:
如果我误解了你的问题,请告诉我。我想修改一下。