How-to use Google Sheets with Oauth2 Credentials
Oauth2 authentication is a method to authenticate Google Sheets flows, you can use your main account with this method.
The following steps generate a Service Account for Google Sheets API.
Select or create a new project. You have to create one if you don't have a project.
- Open the menu and click APIs & Services -> Library.
- Search for Google Sheets API.
If you want to use Google Sheets package, you can use this Credentials for all the Google Sheets nodes except the "Create Spreadsheet" node. This node may need a Google Drive API in some cases like sharing the spreadsheet. By following the same steps for Google Drive API and you can use same credentials for Google Drive automation too.
- After clicking Google Sheets API in the search results, Google Sheets API's homepage will be opened. Click the "ENABLE" button on the page.
- After enabling the API, it will redirect you to the overview page of Google Sheets API.
- Go to APIs & Services > OAuth consent screen and start to configure your application.
- Select user type of your application then click Create.
If you are not a Google Workspace user, you must select external in this step.
- If user type of your application is external then you need to add your main account as a test user by clicking "ADD USERS" button.
Fill out the app information form (App name, User support email and contact information is required) then click "SAVE AND CONTINUE" button.
You can just pass Scopes screen by clicking "SAVE AND CONTINUE" button. If your app's user type is external then you may need to add yourself as a test user in Test users screen.
- Click the "Credentials".
- In this screen click "CREATE CREDENTIALS" then select OAuth client ID.
- Select Desktop app then click "CREATE".
- A pop-up will appear click "DOWNLOAD JSON".
- Create a vault item (as document item) and copy the content of downloaded json file to this vault item. For more information about creating vault items see here.