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.
- Go to the Google Developer Console.
- Click Select a Project or create a New Project. If you have an existing project, you can select it from ALL.
- Provide valid values for the project and click Create.
- Navigate to Dashboard on Google Developer console and click ENABLE APIS AND SERVICES.
- Search for Google Drive API for Google Drive Plugin >Click on ENABLE.
- Search for Google Sheets API. Click Enable.
Create Client ID and Client Secret
- Navigate to the tab OAuth consent screen and choose the valid option.
- Enter the App name, User support email, Authorized domains, Developer contact information > click SAVE AND CONTINUE button.
- Click on ADD OR REMOVE SCOPES button.
- 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.
- Click on ADD USERS button
- Provide valid email ID > click ADD button > click SAVE AND CONTINUE button.
- Click on Credentials tab > click CREATE CREDENTIALS and from the dropdown-list select OAuth client ID.
- From the Application type, select the Web Application.
- Enter valid Name and Authorized Redirect URIs > Click CREATE button. Authorized Redirect URIs: https://developers.google.com/oauthplayground
- Copy Client ID and Client Secret > click OK button.
- Get Client ID and Client Secret by clicking on the OAuth 2.0 Client IDs.
Generate Refresh Token
- Go to the Google OAuth Playground.
- Click on the Settings icon.
- Click on Use your own OAuth credentials and enter OAuth Client ID and OAuth Client secret generated from the previous step.