How to Connect to Google Sheets via API from your n8n workflow (Step‑by‑Step)

To connect to your Google Sheets, n8n can not use a simple “API key.” Instead, you give n8n a special Google service account that has permission to open your spreadsheet. This article walks you through the entire process in a non‑technical, user-friendly way.


What you will set up

In summary, by the end of this guide, you will:

  • Create a Google Cloud project and turn on the Google Sheets API.
  • Create a service account and download its JSON key file.
  • Share your Google Sheet with that service account email.
  • Add the JSON key into n8n as Google Service Account credentials and test a Sheets node.

You can use this as a personal reference and also share it with non‑technical teammates.


Step 1 – Create a Google Cloud project

A Google Cloud project is just a container for all your API settings and credentials.

  1. Open: https://console.cloud.google.com/ and sign in with the Google account that owns your Sheets.
  2. At the top, click the project selector (it might say “My First Project”).
  3. Click New Project.
  4. Enter a name like n8n-google-sheets and click Create. Formulate your own naming convention. Personally, for development environment, I would add “dev-” to the project name. Examples: dev-project-name or prod-project-name.
  5. After a few seconds, open the project selector again and make sure your new project is selected.

Once the project is selected, any APIs or credentials you create will belong to this project.


Step 2 – Enable the Google Sheets API

Next, you must explicitly turn on the Google Sheets API for this project.

  1. In the left menu, go to APIs & Services → Library.
  2. In the search bar, type: Google Sheets API.
  3. Click Google Sheets API.
  4. Click the Enable button.
  5. In the same Library page, also enable Google Drive API.
    • This can help with file access and discovery in some setups.

Step 3 – Create a service account

A service account is a special Google identity (a “robot user”) that your n8n workflow will use to access your sheet.

  1. In the left menu, go to IAM & Admin → Service Accounts.
  2. Click + Create Service Account.
  3. Enter:
    • Service account name: n8n-sheets-bot
    • Service account ID will auto‑fill.
  4. Click Create and continue.
  5. For Role, choose Editor for now (you can tighten permissions later).
  6. Click Continue, then Done.

You will now see your service account listed with an email like: n8n-sheets-bot@your-project-id.iam.gserviceaccount.com

Keep this email handy; you will share your Google Sheet with it later.


Step 4 – Download the JSON key file

This JSON file is what you’ll upload or paste into n8n, so it can log in as the service account.

  1. Still in IAM & Admin → Service Accounts, click on your service account (n8n-sheets-bot).
  2. Open the Keys tab.
  3. Click Add key → Create new key.
  4. Select JSON.
  5. Click Create.

Your browser will immediately download a .json file, for example: n8n-sheets-bot-1234567890.json

This file contains:

  • The service account email.
  • A private key that proves to Google that n8n is allowed to act as this account.

Store this file in a safe place; do not commit it to Git or share it publicly.


Step 5 – Share your Google Sheet with the service account

Even with correct credentials, n8n cannot see your sheet until you grant this service account access.

  1. Open the Google Sheet you want n8n to use.
  2. Click the blue Share button in the top right.
  3. In “Add people and groups”, paste the service account email from:
    • The Google Cloud console or
    • Inside the JSON file (look for the client_email field).
  4. Choose a permission:
    • Viewer if n8n only needs to read data.
    • Editor if n8n should add/update rows.
  5. Click Send.

Google will not send an email to the robot account, but the permission will be applied.

If this step is skipped, you will often see “The caller does not have permission” errors later.


Step 6 – Create Google Service Account credentials in n8n

Now you will tell n8n about this JSON key so it can authenticate to Google.

  1. Log into your n8n instance (Cloud or self‑hosted).
  2. Go to Credentials (in the left menu or under Settings, depending on version).
  3. Click + New (Add credentials).
  4. Search for “Google Service Account” and select it.
  5. In the credential form:
    • If there is an Upload option:
      • Click to upload the .json file you downloaded.
    • If there is a JSON text box:
      • Open the .json file in a text editor.
      • Copy all its contents.
      • Paste it into the JSON field exactly as is.
  6. Give the credential a clear name, for example:
    Google Sheets – Service Account.
  7. Click Save.

n8n will usually test the credential automatically and should report a successful connection.

If the test fails:

  • Confirm you used the correct file (not an old or wrong key).
  • Confirm the service account still exists in Google Cloud.
  • Confirm the Google Sheets API is enabled in the project.

Step 7 – Test with a simple Google Sheets node

Now you can create a minimal workflow to confirm everything works.

  1. In n8n, click Workflows → New to create a new workflow.
  2. Add a Manual Trigger node (so you can run the workflow manually).
  3. Add a Google Sheets node and connect it after the Manual Trigger.
  4. Open the Google Sheets node and configure:
    • Authentication: choose Service Account.
    • Credentials: select the credential you just created (Google Sheets – Service Account).
    • Operation: choose Read → Get Many Rows (or similar, depending on your n8n version).
    • Spreadsheet:
      • Copy the Spreadsheet ID from your sheet’s URL.
        Example URL:

        https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=0
        

        Paste SPREADSHEET_ID into the field.

    • Sheet: set the sheet name, for example Sheet1.
  5. Click Execute Node.

If everything is configured correctly, you will see the rows from your sheet appear as items in the n8n node output.


Step 8 – Common errors and quick fixes

Even non‑technical users can fix most issues quickly by checking a few common causes.

Error: “The caller does not have permission”

  • Likely cause:
    • The sheet is not shared with the service account email, or
    • It is shared as Viewer, but you are trying to write data.
  • Fix:
    • Open the sheet, click Share, and confirm the service account email is listed with the correct role.

Error: “Requested entity was not found” (or similar)

  • Likely cause:
    • The Spreadsheet ID is wrong, or
    • The sheet belongs to another Google account with no access.
  • Fix:
    • Copy the ID again from between /d/ and /edit in the sheet URL.
    • Ensure that same sheet is shared with the service account.

n8n credential test fails

  • Likely cause:
    • The JSON was pasted incorrectly or truncated.
    • The key associated with the service account was deleted or rotated.
  • Fix:
    • In Google Cloud → IAM & Admin → Service Accounts → Keys, create a new JSON key.
    • Download it and update your n8n Google Service Account credential with the new file.

When to use OAuth instead of a service account

Service accounts are usually best when:

  • You control the sheets being accessed.
  • You just need server‑side automations running from n8n.

Use OAuth2 instead when:

  • Multiple end‑users need to connect their Google accounts.
  • You’re building an app where each user should grant access individually.

n8n also supports standard Google OAuth credentials, but for most workflow automations, the service account approach described here is simpler and more robust.


Final notes

Once this is set up, you can reuse the same Google Service Account credential for multiple workflows and Sheets in n8n. Consider:

  • Creating one service account dedicated to automation.
  • Restricting sheet access by only sharing the specific spreadsheets that n8n should touch.
  • Rotating keys periodically and updating n8n credentials when needed.

Hope this guide helps you safely and repeatedly connect to your Google Sheets via API from n8n without touching code. Happy building! Feel free to reach out if you have questions. Always great to update this article for better clarity as needed. Email: i [at] 0xrommel [dot] dev.