4
votes

I can't find a way to retrieve notes from a cell. I looked here:https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/get

I can update the note by using the code here: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells

... but I can't find a way to retrieve the note in the first place.

This the result of a values.get call on a cell that has a note...

{u'range': u'Sheet1!D5', u'values': [[u'update CD data']], u'majorDimension': u'ROWS'}

as you can see, the notes to the cell are not there.

1

1 Answers

6
votes

How about using sheets/data/rowData/values/note to the fields?

The endpoint is as follows.

GET https://sheets.googleapis.com/v4/spreadsheets/### Spreadsheet ID ###?fields=sheets%2Fdata%2FrowData%2Fvalues%2Fnote

From your profile, if you use Python, how about this?

response = service.spreadsheets().get(spreadsheetId=id, fields="sheets/data/rowData/values/note").execute()

Result:

When there are notes at "A1:B2", the result is as follows.

{
  "sheets": [
    {
      "data": [
        {
          "rowData": [
            {
              "values": [
                {
                  "note": "sample note A1"
                },
                {
                  "note": "sample note B1"
                }
              ]
            },
            {
              "values": [
                {
                  "note": "sample note A2"
                },
                {
                  "note": "sample note B2"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

Reference:

If I misunderstand your question, please tell me. I would like to modify it.