Using the same row in a Google Sheet for questions located on different pages of Retool

In my Retool application, I have multiple pages, and each of these pages has a form. Currently, on the first page, I'm using "add rows" to create a new row with my data in my Google Sheet, which works great. However, on the following pages, as long as it's the same user, I don't want it to create new rows but instead add the data to the same row. How can I achieve this?
I want "11-100" on b1 and "test" on C1.

Hey Dorian - welcome!

If you use {{}} it will push rows - additionally if you don't want to include the whole form you just need to make sure the data is structured in an object format (or array of objects).


Does this work for you?

I am not using a form component for my pages. For example, on the first page, I have a select component, and on the second page, I have a text input (see attachments number 1 and 2). But my main issue is that each question is on a different page, so it doesn't reuse the previous row, and that's what I would like to achieve.

In that case you can use a temporary state to temporary store values until you get to the last one, and then use the temporary state to push back to the sheet. Once done you can reset the temporary state value to the initial [].

Or alternatively you can go through the pages and on the last one submit your data i.e.

{{ [ {'Option':select1.value},{'User 1':textInput1.value} ] }}

On success clear the used fields and you are done!

Does this help?

Even though I'm not sure I fully understand, I will try to implement these solutions and I will get back to you to let you know if it works. In the meantime, I have another question:

Once I have set up the row, I would like to retrieve information from a cell based on the logged-in user. To provide you with more details, I have created a questionnaire on Retool that users will fill out, and their responses are stored in a Google Sheet. From there, calculations are performed, and I would like to retrieve the results of these calculations based on the user and display them on a results page in Retool, so that users can see their results. How can I achieve this?

You need to store {{}} or some other identifier value to later use those to segment the data you load from the sheet and display it to the appropriate user.

I am unable to retrieve my temporary state that I saved earlier on my last page (currently, there are only 2 pages, but there will be more in the future) (see attachments 1 and 2).

The error is on last page

Depends how are those pages set up. Are you using breadcrums or simply switching container views with buttons?

Also could you share how the temp state is set up (in the example I showed I start with an empty array and then concentrate new values, with .setValue you are clearing the state and replacing it with new value)

I don't know what a breadcrumb is, so I only use buttons that navigate to the next page.

I have sent you everything I have done. I simply used .setValue on my button with the value from the select component, and I thought that was enough. Do I need to do anything else, and if so, what should I do?

how and where have you initialize storedAnswers to []?

That's how I've set it to an empty array. Each button then will .concat() to that value.

I make this but on the second page i can't select select1 or state1.

Ah I see it now...

Basically you are opening a different app with utils.openApp() in that case you need to pass the value to the next app (once you open a different app you cannot reference temporary states, components etc. from previous app unless passed within hash or query parameters).


Once you are on the next page (app) you can see the passed value in "State".

So now you can reference passed value:

Hope that clarifies it.

To achieve this, I used local storage. If this method works, I will keep it as an option. Thank you very much. However, as you have seen, I also added the current_first_name to my Google Sheet. Now, how can I display the data related to this current_first_name?
For exemple here (appointment 1) i want to display the number of company members whose name is Dorian (appointment 2)


So you would need to query the resource and then transform it or filter it per your need.

So assuming recup_data_sheet2 is your query you can user "Query JSON with SQL".

Or if you're more familiar with JS you can use transformer or the transformer which is part of the query.

Additionally - I strongly suggest using email or some other unique identifier as over time just Names will repeat and won't be unique anymore :slight_smile:

It worked perfectly, thank you so much! Yes, I will consider changing the name to the email or ID. Thank you again!

Hello, I apologize for bothering you again, but since you helped me so well two days ago, I feel comfortable reaching out to you again.
Now that I'm retrieving data from the Google Sheet, I would like to display it in a chart, but I'm encountering a problem with the "value labels" that prevent me from seeing the desired data. I'm sending you screenshots of what I want and what I have. Can I have your assistance with this?
I want this :

I have this :

Hey Dorian,

I'll reply on the other post you have created :slight_smile:

I don't have your response