Skip to main content

Google Sheets: Generate Token

Google Sheets Refresh Token Generation

It is assumed that you have a Google developer console account created on https://console.developers.google.com. In this Appendix we complete the Google Spreadsheet steps prerequisites.

  • Enable APIs for Google Spreadsheet
  • Generate Client ID and Client Secret
  • Generate Refresh Token in exchange for the Client ID and Client Secret

References
Google Spreadsheet documentation: https://developers.google.com/sheets/api

Enable APIs

In this section we will Enable APIs for Google Spreadsheet.

  1. Go to the Google Developer Console.
  2. Click Select a Project or create a New Project. If you have an existing project, you can select it from ALL.
Google Developer Console - Select Project
  1. Provide valid values for the project and click Create.
Google Developer Console - Create Project
  1. Navigate to Dashboard on Google Developer console and click ENABLE APIS AND SERVICES.
Google Developer Console - Enable APIs and Services
  1. Search for Google Drive API for Google Drive Plugin >Click on ENABLE.
Google Developer Console - Enable APIs and Services
  1. Search for Google Sheets API. Click Enable.
Google Developer Console - Enable APIs and Services

Create Client ID and Client Secret

  1. Navigate to the tab OAuth consent screen and choose the valid option.
OAuth consent screen
  1. Enter the App name, User support email, Authorized domains, Developer contact information > click SAVE AND CONTINUE button.
App Details
  1. Click on ADD OR REMOVE SCOPES button.
Add or Remove Scopes
  1. Select Google Sheet API and scope selected in following image > click UPDATE button > click SAVE AND CONTINUE button. Note: Select appropriate permissions required to perform the specific actions desired by you.
Select Scopes
  1. Click on ADD USERS button
Add Users
  1. Provide valid email ID > click ADD button > click SAVE AND CONTINUE button.
Provide Email ID
  1. Click on Credentials tab > click CREATE CREDENTIALS and from the dropdown-list select OAuth client ID.
Create Credentials
  1. From the Application type, select the Web Application.
Application Type
  1. Enter valid Name and Authorized Redirect URIs > Click CREATE button. Authorized Redirect URIs: https://developers.google.com/oauthplayground
Authorized Redirect URIs
  1. Copy Client ID and Client Secret > click OK button.
Authorized Redirect URIs
  1. Get Client ID and Client Secret by clicking on the OAuth 2.0 Client IDs.
[Get Client ID and Secret

Generate Refresh Token

  1. Go to the Google OAuth Playground.
  2. Click on the Settings icon.
  3. Click on Use your own OAuth credentials and enter OAuth Client ID and OAuth Client secret generated from the previous step.