Googlesheets multiple rows with one same cell

Hi, I have a google sheet like this in my flow. It is a simple train search for passenger. When the user/passenger searches for Pune my flow is able to return the first row. But I need to return all the train for that particular destination and let the user choose a train.

I want to know how do I return multiple rows with variables like {train_name 1} {train_name 2}
(This forum doesn’t allow me to upload more than one screenshot otherwise I could’ve shown you my flow also)
Thanks in advance

Google Sheets Block cannot return multiple rows. If you want to do so, use API Block to get a whole response from Google sheets and handle its data with Code Block using JavaScript.

To get whole response from Google Sheets with API Block, this might be help (although this is very old)

The Another way I think is to combine with Google Sheets function and looping. This idea is like this:

  • get the index number of last non-empty cell in a column. This is the maximum number of indexes.
  • starts to retrieve data with an index number as condition.
  • increment that index number.
  • go back to the begining.
  • if the index number matchs with the maximum index number, get out from loop.

Hey @kun432, Thanks so much. So the scenario is this: Passenger wants to go ‘Pune’ so the CA will have to reply ‘I found two trains to Pune: Pragati & Gandhi Express. Which one do you want to take?’. Right now the flow is able to reply the first train.

I have a variable called {Destination} which has the data from the destination column in the google sheets and the user’s choice will be saved as {station}. So I’m checking whether {Destination}={station} and replying the row.

Based on the tutorial you shared I got the JSON and the API request successful. Now how do I write the query for checking multiple entries with the value Pune and return the corresponding column data?

How would you suggest to do this. Please help me, I’m currently completing my masters thesis and this is the prototype to submit.

These are the two contents that I need to pull:
and say: “I found two trains to Pune - train1(Pragati express), train2(Gandhi express)”

And also now looking at this JSON data I’m wondering why all the columns after ‘Pune’ are merged into the content? Will I be able to pull the individual data like ‘departure’? Because during the conversation users might refer to the departure time and ask questions respective to that.

I’ll be grateful for you to help me out. I’ve to show my design prototype to the jury tomorrow.

Seems like the next answer din’t get on time, sorry to see that prior your prototype demonstration to the jury.
Just like Kun432 said, having the API object needs to use a data with Code Block using JavaScript , and this is the thing, you need to know how to code using JAVA in order to say next, you need to write the code for that command. I’m stuck with the same situation.

If somebody here knows how to write that code I’ll appreciate that

Can you please elaborate how to do this . I am a beginner in this so i know the basics so can u give a step-by-step on how to do this

I have an excel sheet with 4 columns (item,brand,price and location) so having a item and brand input from user (through voice flow) how can i find the row number to get the corresponding price and location.

Looking forward to any sort of guidance and help.Thanks!