38
Views
8
Comments
How can I use a Google Sheet as my data or update an entity with data from a Sheet
Application Type
Reactive
Service Studio Version
11.54.51 (Build 63195)
Platform Version
11.27.0 (Build 42539)

I'm trying to use a Google Sheet as my data source or alternatively update my entity with data from this Google Sheet. I seem to have the authentication working right from the Google Authentication Demo on Forge but I'm not sure what nodes I need to use to actually do something with this data rather than just display it. I am also very new to Outsystems.

2021-04-12 11-47-04
Bart Nooijens

Hi @Bradley Oxley,

We did this using the Google Sheets API. See the below steps as a reference. As you told in your intro that you have the authentication part working I am not going to explain how to do that.

1. Consume a REST API (https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range})

2. Create a server action to retrieve the data 

Hope this helps you a bit.

Best,

Bart

UserImage.jpg
Bradley Oxley

Thank you for this, however what are the steps actually move this data into the database please? I see nodes like JSON deserialise but it doesn't work

2021-04-12 11-47-04
Bart Nooijens

Hi @Bradley Oxley,

I think there are several ways to do this. 

As you can see in the screenshot below we retrieve the spreadsheet data and loop over the result of the server action. Then we append the data to a list. Instead of appending it to a list you could insert it into the db.

Does this make any sense?

Best,

Bart

UserImage.jpg
Bradley Oxley

Thank you, this is, is there a way I can integrate what I have with the Google Authentication Demo as I dont understand how to set up the REST API thing? Thank you

2021-04-12 11-47-04
Bart Nooijens

Hi @Bradley Oxley,

I think Shriyash mentioned the steps on how you could try that. I do not have expertise on those forge components.

Best,

Bart

UserImage.jpg
Bradley Oxley

Okay thank you very much for your help, I will wait for his reply

UserImage.jpg
Shriyash Dixit

Hello @Bradley Oxley

This might help you to integrate a Google Sheet with your OutSystems application and either use it as a data source or update an entity with data from the sheet, you can follow these steps: 

Set up Google Sheets API: 
-Go to the Google Developers Console (https://console.developers.google.com/).
(https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get)
-Create a new project or select an existing one.
-Enable the Google Sheets API for your project. 
-Create credentials (OAuth client ID) for your project to authenticate requests to the API. 
-Download the credentials file (JSON format) containing client ID, client secret, etc.  
-Use the Google Authentication Forge component to enable authentication with Google services in your OutSystems application. 
-Follow the documentation provided by the Forge component to set up authentication using the credentials  

Use the Google Sheets Connector Forge component to interact with Google Sheets from your OutSystems application.  Install the component into your environment and configure it with the necessary authentication credentials. Use the provided actions in the Forge component to read data from the Google Sheet, such as GetSheetValues. 

After retrieving data from the Google Sheet, you can iterate over the rows and update your entity using entity actions. 

Cheers,
Shriyash Dixit

UserImage.jpg
Bradley Oxley

Thank you for your reply, could you perhaps show the nodes needed to iterate over the rows and update, as I'm only starting to use OutSystems in the last couple of weeks and i'm struggling to understand the logic side for a lot of things

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.