Google Sheets cell update/add data

Is there a way to update a single cell via n8n Google sheets node in a row with data.

Example: I want to only update Column ‘D’ in Google sheets, after submitting POST Request to an API with the fields in column A, B and C.

date

That is possible with using “RAW Data”.

Here an example of how you can set a whole column (D):

{
  "nodes": [
    {
      "parameters": {
        "functionCode": "items[0].json.data = [ [ \"header\" ], [ \"value1\" ], [ \"value2\" ], [ \"value3\" ] ];\n\nreturn items;"
      },
      "name": "Function3",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1200,
        950
      ]
    },
    {
      "parameters": {
        "operation": "update",
        "sheetId": "1BwOqd-mk-rAJbLs--WRpHEkPJa949vNlRvhM5X8MkcA",
        "range": "D:D",
        "rawData": true,
        "options": {}
      },
      "name": "Google Sheets whole Row",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1400,
        950
      ],
      "credentials": {
        "googleApi": "[email protected]"
      }
    }
  ],
  "connections": {
    "Function3": {
      "main": [
        [
          {
            "node": "Google Sheets whole Row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

And and example how to update a single cell (D5):

{
  "nodes": [
    {
      "parameters": {
        "functionCode": "items[0].json.data = [ [ \"value\" ] ];\n\nreturn items;"
      },
      "name": "Function4",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1200,
        1150
      ]
    },
    {
      "parameters": {
        "operation": "update",
        "sheetId": "1BwOqd-mk-rAJbLs--WRpHEkPJa949vNlRvhM5X8MkcA",
        "range": "D5:D5",
        "rawData": true,
        "options": {}
      },
      "name": "Google Sheets single cell",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1400,
        1150
      ],
      "credentials": {
        "googleApi": "[email protected]"
      }
    }
  ],
  "connections": {
    "Function4": {
      "main": [
        [
          {
            "node": "Google Sheets single cell",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Ahh yes, only send the ID (whatever that is for your case) and the data-submitted in the input. I updated only the age column, as shown in the picture, with the example workflow below.

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        -170,
        120
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "operation": "update",
        "sheetId": "14ZJZBWmOWOFr9NldppEHnACOTReECG3olxG7VgLInHI",
        "range": "A:C",
        "options": {}
      },
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        270,
        120
      ],
      "credentials": {
        "googleSheetsOAuth2Api": "asasasasasas"
      }
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "age",
              "value": "2"
            }
          ],
          "number": [
            {
              "name": "id",
              "value": 1
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        30,
        120
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}