Get Credentials for Google Spreadsheet

To obtain the Access Token, Client Id, Client Secret and Refresh Token, we need to follow the below steps.

  1. Open the Google API Console Credentials page. You will be prompted to log in to a Google Account. Log in to your relevant Google Account.

  2. Click on Select a Project and click NEW PROJECT, to create a project. Creating a new Project

  3. Enter SpreadsheetConnector as the name of the project and click Create.

  4. Click Configure consent screen in the next screen.

Consent Screen

  1. Provide the Application Name as SpreadsheetConnector in the Consent Screen.

Consent Screen

  1. Click Create credentials and click OAuth client ID.

Create Credentials

  1. Enter the following details in the Create OAuth client ID screen and click Create.
Type Name
Application type Web Application
Name SpreadsheetConnector
Authorized redirect URIs https://developers.google.com/oauthplayground
  1. A Client ID and a Client Secret are provided. Keep them saved. Credentials

  2. Click Library on the side menu, search for Google Sheets API and click on it.

  3. Click Enable to enable the Google Sheets API. Enable Google Sheets API

Obtaining Access Token and Refresh Token

  1. Navigate to OAuth 2.0 Playground and click the OAuth 2.0 Configuration button in the top right corner of your screen.

  2. Select Use your own OAuth credentials, and provide the obtained Client ID and Client Secret values. Click on Close. Obtaining Oauth-configuration

  3. Under Step 1, select Google Sheets API v4 from the list of APIs and select all the scopes. Selecting Scopes

  4. Click on Authorize APIs button and select your Gmail account when you are asked and allow the scopes. Grant Permission

  5. Under Step 2, click Exchange authorization code for tokens to generate and display the Access Token and Refresh Token. Now we are done with configuring the Google Sheets API. Getting Tokens

Top