Unlock Your Data: A Step-by-Step Guide to Connecting n8n with Google Sheets
Google Sheets is a powerhouse for storing and organizing data, while n8n is a master of workflow automation. Connecting them opens up a world of possibilities, from automatically logging form submissions to generating custom reports on a schedule.
While the connection process is straightforward, it involves several precise steps within the Google Cloud Console. This guide will walk you through the entire setup, step-by-step, ensuring you get it right the first time.
Prerequisites
Before you begin, make sure you have the following:
- An active n8n instance (either cloud or self-hosted).
- A Google account that you’ll use to access Google Sheets.
Let’s get started!
Step 1: Create a Google Cloud Project
First, we need to create a project in the Google Cloud Platform, which will house our API settings.
- Navigate to the Google Cloud Console.
- At the top of the page, click the project selector dropdown (it might say “Select a project”).
- In the pop-up window, click NEW PROJECT.
- Give your project a descriptive name (e.g., “n8n-integrations”) and click CREATE.
- Once created, ensure you have this new project selected from the top-down menu.
Step 2: Enable the Google Sheets API
Next, we need to tell Google that this project will be using the Google Sheets API.
- In the top search bar of the Google Cloud Console, type “Google Sheets API” and select it from the results.
- On the Google Sheets API page, click the blue ENABLE button. You’ll be redirected to the API’s dashboard once it’s enabled.
Step 3: Configure the OAuth Consent Screen (Crucial Step!)
Before you can create credentials, you must set up an OAuth consent screen. This is the screen users see when granting your application permission to access their data.
- From the left-hand navigation menu, go to APIs & Services > OAuth consent screen.
- User Type: Select External and click CREATE.
- App Information:
- App name: Give your app a name (e.g., “My n8n Automation”).
- User support email: Select your email from the dropdown.
- Developer contact information: Enter your email address at the bottom of the page.
- Click SAVE AND CONTINUE.
- Scopes: Scopes define what permissions your app is requesting. For simplicity in this setup, we’ll add the basic user info scopes. Click ADD OR REMOVE SCOPES, select the first three checkboxes (…/auth/userinfo.email, …/auth/userinfo.profile, openid), and click UPDATE. Then, click SAVE AND CONTINUE.
- Test Users: While your app is in “testing” mode, only explicitly added users can authorize it.
- Click + ADD USERS.
- Enter the same Google email address you’ve been using for this setup.
- Click ADD.
- Finally, click SAVE AND CONTINUE.
Step 4: Create Your OAuth 2.0 Credentials
Now it’s time to get the Client ID and Client Secret that n8n needs to authenticate.
- In the left-hand menu, navigate to Credentials.
- Click + CREATE CREDENTIALS at the top and choose OAuth client ID.
- Application type: Select Web application.
- Name: You can leave the default name (e.g., “Web client 1”).
- Authorized redirect URIs: This is a critical step where we need to get information from n8n.
- Switch to your n8n tab.
- Go to Credentials > Add credential.
- Search for and select Google Sheets OAuth2 API.
- A new window will open. Copy the OAuth Redirect URL provided. It will look something like https://your-n8n-instance.com/rest/oauth2-credential/callback.
- Switch back to the Google Cloud tab.
- Under “Authorized redirect URIs”, click + ADD URI and paste the URL you just copied from n8n.
- Click the blue CREATE button.
Step 5: Add Your Credentials to n8n
Google will now show you a pop-up with your Client ID and Client Secret. We’ll put these into n8n.
- Copy the Your Client ID from the Google pop-up.
- Paste it into the Client ID field in your n8n credential window.
- Go back to Google, click to reveal Your Client Secret, and copy it.
- Paste it into the Client Secret field in n8n.
- Click the blue Sign in with Google button.
A Google sign-in pop-up will appear. Follow these prompts:
- Choose the Google account you added as a test user.
- You may see a “Google hasn’t verified this app” warning. This is expected. Click Continue.
- Grant the permissions by checking the boxes and clicking Continue.
- A success window will appear. You can now close this pop-up window.
Important Note on a UI Quirk:
Sometimes, the n8n interface doesn’t immediately show that the connection was successful. If your credential still looks unsaved, simply close the credential window in n8n and refresh the credentials page. When you re-open it, you will see a green “Account Connected” message.
Step 6: Test Your Connection!
The final step is to confirm everything is working by running a simple test.
- Create a new workflow in n8n.
- Add a Google Sheets node.
- Credential to connect with: Select the Google Sheets credential you just created.
- Resource: Choose Spreadsheet.
- Operation: Choose Create.
- Title: Give your test sheet a name, like “n8n Connection Test”.
- Click Test step.
If the node executes successfully, you have done it! Head over to your Google Sheets homepage, and you will see your newly created spreadsheet.
You are now fully connected and ready to build powerful automations between n8n and Google Sheets. Happy automating