Google Sheets
This documentation is outdated. For the up-to-date version, visit: https://docs.procesio.com/integrations/oauth2-google-sheetsο»Ώ
ο»Ώ
π‘ Imagine automating your work processes and workflows with PROCESIO and having all the data and information automatically transferred and updated in your Google Sheets. This can save you a lot of β° and effort, and make your life a whole lot easier! π For example, let's say you're running a small business and you need to keep track of your inventory. You can use PROCESIO to create an automated workflow that updates your inventory every time a new order is placed. And by integrating PROCESIO with Google Sheets, you can have all that data automatically transferred and updated in a spreadsheet that you can access from anywhere, at any time. π But that's not all! You can also use Google Sheets to visualize and analyze the data collected by PROCESIO. For example, you can create charts and graphs to track sales trends or use conditional formatting to highlight low inventory levels. π€ And the best part? You don't need to be a tech whiz to integrate PROCESIO with Google Sheets. The process is straightforward and easy to follow, and you can find lots of resources online to guide you. π» What are you waiting for? Put your thinking hats on and let's see the configurations we need to tackle.
Prerequisites:
- A PROCESIO account and a Google account
To POST in Google Sheets, we'll need an OAuth Access Token, API keys only work for GET requests.
- First, we are going to create a new project in the Google Cloud Console for API Services:
Make sure to select the newly created project from the project selector in the top left corner.
- We now need to enable Google Sheets API. Hereβs where you can enable it from.
- Once Google API is Enabled, click the Manage button.
- Proceed with creating a Credential by clicking the Create Credentials button in the top right corner.
- Select Google Sheets API from the Select an API drop-down and then hit Next.
- Click Add or Remove Scopes to select the scopes for this credential.
- Filter by API: Google Sheets API, select the scopes from the screenshot and press Update.
You can only Filter by Google Sheets API, if you enabled it.
- Hit the Save and Continue button to go further.
Fill in the OAuth Client ID details as below.
- Application type β Web application
- Name β Give a name to the credential (PROCESIO will be ok for now)
- Authorized redirect URIs
- URIs 1 β https://procesio.com/
- URIs 2 β https://procesio.app/
Don't forget to click Create after you fill in the details.
- Hit Done and you're done with the credential part for now.
To generate an OAUTH token, we'll need 3 things:
- ο»Ώclient_id - part of the Google Sheets API Credential we just created.
- ο»Ώclient_secret - also part of the Google Sheets API Credential we just created.
- ο»Ώcode - secret code valid for 60 seconds after obtaining it.
- From within Google API Console navigate to the credential tab, and click the credential you've just created.
Make sure you have the right project selected.
- Now copy the values for Client ID and Client secret and save them for later.
Now that we have the client_id and client_secret ,we only need to get the code so that we can use it to receive the OAuth token. The code has a 60 second validity so before obtaining it, we'll prepare a request in Postman so that we can just Obtain the code & Send the request straight away.
- Open Postman and configure a POST request with x-www-form-urlencoded body type.
- Set the following key-value pairs
- grant_type β authorization_code
- ο»Ώcode β here you need to add the code we obtain in the next stepο»Ώ
- ο»Ώclient_id β Value of Client ID that you saved.
- ο»Ώclient_secret β Value of Client secret that you saved.
The request is ready to be sent and only needs the code. To obtain the code you need to:
- Build an URL as per below:
In the green highlighted section you will insert the value of Client ID just like in the request.
- Copy the URL & paste it into a browser. This should prompt you to select a corresponding account to which resources will become accessible via OAuth.
Make sure to sellect the right account.
- Once you logged in, press the Allow button
- After allowing, youβll be redirected to a screen that should look something like below. This new URL (on which you were redirected) contains the code to be used in POSTMAN for obtaining the Access Token as well as the Refresh Token. (We have about 60 s until the code expires)ο»Ώ
- Complete your Postman request by adding the code and hit Send.
ο»Ώ
- You have now obtained the access token and the refresh token. Make sure to save them πͺ
The access token expires in one hour so a refresh mechanism needs to be put in place.
More on how to refresh the token here.
- Build a basic process with Start β Call API β Stop
We are going to skip testing the credential.
- Create some variables in your process
Name | Type | Default value | Single value | Set as |
---|---|---|---|---|
Token | ο»ΏStringο»Ώ | Bearer access_tokenο»Ώ | β | - |
SheetsAPIStatus | ο»ΏIntegerο»Ώ | ο»Ώ | β | Output |
SheetsAPIBodyOutput | ο»ΏJsonο»Ώ | ο»Ώ | β | Output |
ο»Ώ
- Configure the Call API Action as follows:
Verb β POST
MethodName β /spreadsheets/{SheetID}/values/A1:append
Query Params:
Key | Value |
---|---|
valueInputOption | USER_ENTERED |
Headers:
Key | Value |
---|---|
Authorization | Token |
Body:
- Run the Process & Check your spreadsheet.
More details on the Google Sheets API can be found here.
Stay tuned as we are working on preconfigured Call API Actions with Google Sheets.