Skip to main content

How-to use Google Sheets with OAuth2 Credentials

OAuth2 authenticates as you — the flow acts with your own Google account's access. That makes it the right choice when the automation should see exactly the documents you can see, and the wrong choice for something unattended, where a service account is better.

1. Open the Cloud Console and pick a project

Go to console.cloud.google.com, then select or create a project.

Google Cloud Console

An older address

Guides often still say console.developers.google.com. That redirects to the Cloud Console — same place, older name.

2. Enable the API

Open the menu and go to APIs & Services → Library.

APIs & Services Library

Search for Google Sheets API.

Searching for the Sheets API

Open it and click Enable.

Enabling the API

That lands you on the API's overview page.

Sheets API overview

Google Drive API too

These credentials work for every Google Sheets node except Create Spreadsheet, which sometimes needs the Google Drive API as well — for example when sharing the new spreadsheet. Enable Drive the same way and the same credentials cover both.

Before you can create an OAuth client, the project needs a configured consent screen: who the app is, and who is allowed to use it.

In current versions of the console this lives under Google Auth Platform, with the settings split across Branding, Audience and Data Access. Older projects still show it as APIs & Services → OAuth consent screen as a single flow. The information asked for is the same either way:

What it asksWhat to give it
User type / AudienceExternal unless you are a Google Workspace user. Internal is only available to Workspace organisations
App informationApp name, user support email and developer contact. All required
ScopesCan be left alone — the scopes are requested by the client at sign-in
Test usersWith an unverified external app, add your own account here, or sign-in will be refused
The step people miss

An External app that has not been through Google's verification only works for accounts listed as test users. If authentication fails with "app not verified" or the account is rejected, this is almost always why.

4. Create the OAuth client

Go to Credentials.

Credentials

Click Create credentials and choose OAuth client ID.

Create credentials

Choose Desktop app as the application type, then Create.

Desktop app

Desktop app, even on a server

Desktop app is right even when the robot runs on a server. It is the client type that supports the local-redirect sign-in flow Robomotion uses; Web application expects a hosted redirect URI you do not have.

5. Download the JSON

A dialog appears with the client id and secret. Click Download JSON.

Download JSON

6. Put it in a vault

Create a Document vault item and paste the contents of the downloaded JSON into it. Never paste it into a node property — see Vaults.

The vault item

Select that vault item as the Credentials on your Google Sheets nodes.

First run opens a browser

The first time a flow uses OAuth2 credentials, a browser tab opens asking you to approve access. That is expected, and it is also why OAuth2 is a poor fit for unattended automation — nobody is there to click Allow. Use a service account for scheduled flows.

See also