How to access a single cell in Google Sheets?

Problem and Error Message

I cannot access a particular cell in Google Sheets. Suppose I want to access the cell B3 (it does not have a title therefore I can’t use the Google Sheets node), Im trying to make an api PUT call to the google sheet services but I always get the 400 error.

Workflow

{
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
0,
0
],
“id”: “49442ab6-2cc4-46f3-8edf-b7c86ebe6f12”,
“name”: “When clicking ‘Execute workflow’”
},
{
“parameters”: {
“documentId”: {
“__rl”: true,
“value”: “1Oq8QgWks__k8EnR0ImiRnQ8X8lmWl3Edsmnv0bHo5f4”,
“mode”: “list”,
“cachedResultName”: “Prueba N8N”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1Oq8QgWks__k8EnR0ImiRnQ8X8lmWl3Edsmnv0bHo5f4/edit?usp=drivesdk
},
“sheetName”: {
“__rl”: true,
“value”: “gid=0”,
“mode”: “list”,
“cachedResultName”: “Hoja 1”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1Oq8QgWks__k8EnR0ImiRnQ8X8lmWl3Edsmnv0bHo5f4/edit#gid=0
},
“filtersUI”: {
“values”:
},
“options”: {}
},
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 4.7,
“position”: [
208,
0
],
“id”: “db805276-2572-4ca5-bb9b-6b55c4ec91e4”,
“name”: “Get row(s) in sheet”,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “mPdeJzQl3gXvz8y8”,
“name”: “Google Sheets account”
}
}
},
{
“parameters”: {
“jsCode”: “// Leer el valor del nodo anterior (Google Sheets)\nconst productName = $input.first().json[“nombre_producto”];\n\nconst SPREADSHEET_ID = “100KzIm8yC_XMtWwjSpxyf77i-c5YApHfgBG-KAdUuzw”;\nconst SHEET_NAME = “Sheet2”;\nconst CELL = “C5”;\n\n// Escapar el nombre de la hoja para la URL\nconst rangeUnescaped = ${SHEET_NAME}!${CELL};\nconst rangeEscaped = encodeURIComponent(rangeUnescaped);\n\nreturn {\n json: {\n spreadsheetId: SPREADSHEET_ID,\n range: rangeUnescaped,\n rangeEscaped: rangeEscaped,\n productName: productName,\n valueInputOption: “USER_ENTERED”\n }\n};”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
416,
0
],
“id”: “eb1b2334-e69f-4cfa-9bd5-3d1aaa53e308”,
“name”: “Code in JavaScript”
},
{
“parameters”: {
“method”: “PUT”,
“url”: “=https://sheets.googleapis.com/v4/spreadsheets/{{$json.spreadsheetId}}/values/{{$json.rangeEscaped}}”,
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “googleSheetsOAuth2Api”,
“sendQuery”: true,
“queryParameters”: {
“parameters”: [
{
“name”: “valueInputOption”,
“value”: “={{$json.valueInputOption}}”
}
]
},
“sendBody”: true,
“bodyParameters”: {
“parameters”: [
{
“name”: “range”,
“value”: “={{ $json.range }}”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.4,
“position”: [
624,
0
],
“id”: “5b7b62de-60b9-445d-9ce4-1f86026b4522”,
“name”: “HTTP Request”,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “mPdeJzQl3gXvz8y8”,
“name”: “Google Sheets account”
},
“googleOAuth2Api”: {
“id”: “tPyIQ2oPHyPQpVLt”,
“name”: “Google account”
},
“httpBearerAuth”: {
“id”: “gyieKrDlXkIBhP83”,
“name”: “Bearer Auth account”
}
}
}
],
“connections”: {
“When clicking ‘Execute workflow’”: {
“main”: [
[
{
“node”: “Get row(s) in sheet”,
“type”: “main”,
“index”: 0
}
]
]
},
“Get row(s) in sheet”: {
“main”: [
[
{
“node”: “Code in JavaScript”,
“type”: “main”,
“index”: 0
}
]
]
},
“Code in JavaScript”: {
“main”: [
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
},
“HTTP Request”: {
“main”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “0b6c66b4ec7d77f1bc1431e9bf09ce056d60b6594616ddd664cd3a2596eacd8b”
}
}

Output returned by the last node

Bad request - please check your parameters
Unable to parse range: Sheet2!C5

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: MacOS

Hey @Geremias_Lovera,
Welcome to the community,

the error in your screenshot is real and the cause is simple: Google Sheets API can’t parse the range because you’re passing Sheet2!C5 in the URL without encoding it.

In the Sheets v4 endpoint, the range sits in the URL path (/values/{range}), so the ! must be URL-encoded. Use Sheet2%21C5 (or encodeURIComponent()).

So fix your URL like this:

:white_check_mark: URL:
https://sheets.googleapis.com/v4/spreadsheets/{{$json.spreadsheetId}}/values/{{ encodeURIComponent($json.range) }}
(or hardcode Sheet2%21C5)

Also make sure you’re sending the proper body for an update:

:white_check_mark: Body should be:
{“values”:[[“Truck Camper”]]}

(and keep valueInputOption=USER_ENTERED as a query parameter, not inside the JSON body).

Once you encode the range, the “Unable to parse range: Sheet2!C5” goess away.

Let me know if it helps!!

Hi @Geremias_Lovera ,

I did a quick test by following and maintaining all your configurations in the HTTP Request node except that I make my body content to be using JSON with the following format:

{
“values”: [
[“<Insert your values or formula”"]
]
}

I managed to execute the workflow successfully and it updates the cell (Sheet1!A1 in my case) with the values (“testing”) provided.

Hope this helps.

Here’s my node configuration for your reference.

Hello @Mayank1024!, thanks for taking the time to analyze my problem and try to share a solution. Unfortunately, the problem persists even though I have applied the changes suggested.

I tried to hard code it into the url and still found no result.

Thanks again for the suggestions, but I still run into the same mistakes.

I will keep trying!

Hello @JohnHalex , thank you for answering my post.

I’ve introduced the suggested changes but the result ends up being the same. I still run into a Bad request error. I provide the following screenshot as a proof.

Guess that it will need to be another solution!.

Hello @WilsonT3D, thank you for taking the time to respond my answers. I’ve tried your proposal (and others included in this thread) and still get an error message.

I am now thinking that there might be a problem with my authentication process or API Key because it can’t be that after having tried all these different solutions I still run into the same problems.

Looking at your setup, the issue is likely with how the PUT body and range parameter interact. The Sheets API v4 batchUpdate (PUT) expects the range both in the URL path AND inside the body values object.

Try this structure:

PUT https://sheets.googleapis.com/v4/spreadsheets/{ID}/values/Sheet2!C5
?valueInputOption=USER_ENTERED

Body:
{
  "range": "Sheet2!C5",
  "majorDimension": "ROWS",
  "values": [["your value here"]]
}

Note: no need to encodeURIComponent for the URL path in the HTTP Request node - n8n handles that. And make sure your OAuth2 scope includes https://www.googleapis.com/auth/spreadsheets (not just the readonly scope).

If auth is the issue, check under Credentials > Google Sheets OAuth2 and reconnect - sometimes the token expires silently.

welcome to the n8n community @Geremias_Lovera
I would not focus on authentication yet, because an auth problem normally fails as unauthorized or forbidden, while your current error says Google can’t parse Sheet2!C5. In your shared workflow, the Google Sheets node reads from one spreadsheet, but the HTTP Request updates a different spreadsheet ID, so first confirm that the target spreadsheet really contains a tab named exactly Sheet2. n8n’s Google Sheets docs also distinguish the spreadsheet ID from the sheet ID or tab name, and Google’s values.update endpoint requires a valid A1 range plus valueInputOption, so the request should only be considered after the target document, tab name, and A1 range are aligned.