Help me set up google sheets in n8n guys

Describe the problem/error/question

Hey everyone,
I’m trying to connect a Google Sheet in n8n.
For the Document field in the Google Sheets node, I pasted the spreadsheet ID (the part between “/d/” and “/edit” in the Google Sheets URL).
However, when I execute the workflow, it fails with:
“Could not load list”
and the full error says:
“SecretOrPrivateKey must be an asymmetric key when using RS256”
What could be causing this?
I’m using Google Sheets credentials in n8n. Is there something wrong with my Service Account credentials, private key, or authentication setup?
Any help would be appreciated.

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

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

Hi @Rudra_Bhattacharjee

This error means your Service Account private key lost its newline characters when you pasted it into n8n. The \n characters in the key are required for valid PEM format.

When you copy the private_key from your Google Service Account JSON file, paste it exactly as-is into the n8n credential field. Do NOT remove the \n from the private key. The key should start with -----BEGIN PRIVATE KEY----- and end with -----END PRIVATE KEY----- with \n characters between the line segments.

If you’ve already removed the newlines, re-download a fresh JSON key from Google Cloud Console and paste the private_key value without modifying it.

Also make sure you’ve shared your Google Sheet with the service account email address (the client_email from the JSON file), otherwise you’ll get a permissions error next.

Let me know if it works :crossed_fingers:

Hi @Rudra_Bhattacharjee

The error you’re seeing isn’t actually caused by the spreadsheet ID you pasted, but by how your private key is formatted in the credentials section. Basically, n8n is trying to use your key to prove who you are, but it doesn’t recognize the text as a valid security key, so it stops the process before it even tries to open your sheet.

This usually happens because Google provides the private key in a format that uses the characters \n to represent new lines. If you paste the key as one long string, n8n reads those \n characters as literal text instead of actual line breaks. For the security system to work, the key must be a physical block of text with real breaks between the lines.

To fix this, go back to your credentials and look for the small “expand” or “window” icon on the right side of the Private Key field. Click that to open the multi-line editor, and paste your key there. Make sure it looks like a neat block of text starting with -----BEGIN PRIVATE KEY----- and ending with -----END PRIVATE KEY-----, with no literal \n characters visible.

Once the connection test turns green, there are two last steps to ensure it actually works. First, you must share your Google Sheet with the service account’s email address (the one ending in .gserviceaccount.com) just like you would share it with a coworker. Second, make sure the Google Sheets and Google Drive APIs are turned on in your Google Cloud Console.