Skip to main content

Integrating n8n with Google Sheets using Oauth2

· 2 min read

So, I've been playing around with n8n and I'm a big fan of it, I've been following the project's progress ever since it was initially announced on HackerNews all the way back in Oct 2019.

However, I did face some difficulties in figuring out how to enable the Google Sheets API for interacting with my personal Google Drive (even with the very detailed docs here and here)

Here's a simple summary:

  1. Create a Google Sheet node in n8n

    1. Open up the node edit settings

      Node config

    2. Paste in the sheet ID into the node config ({{ THIS IS THE ID }}/edit)

    3. Click on the edit button for the Oauth2 settings. You will see the redirect URL, and we will need to use it for creating our Oauth2 client.

      Oauth2 Config Popup

  2. In Google Cloud, go to API & Services > Credentials

    1. Create an Oauth2 client (and also configure the Oauth2 permissions popup)

      Create Oauth2 Credential

    2. Select Web Application, fill in your app name as well as the redirect url from above.

      Click on Web Application

      Configure the client

    3. Once created, copy the client ID and secret into the n8n Oauth2 settings page.

      Fill in the Client ID and Secret

  3. In Google Cloud, go to API & Services > Library

    1. Search for Sheets, click through and enable it.

      Click on API Library

      Find Sheets API

Enabling the service is the most important, as without it, the client created in step 2 will not have sufficient permissions to operate the node correctly.

Hope this helps!