Answer based on Google Sheet Value

Hi guys, I got a lil specific question:
I want to create an intent, which the app shall answer based on a specific value in the Google Sheet. Like: If the user asks for a recommendation of a ski resort, the App shall look in the Google Sheet for the ski resort with the highest amount of snow and tell the user which one it is.
How can I do that in Voiceflow?

1 Like

Google Sheets Block cannot specify such a condition like highest.
There are some ways to do this and I recommend google sheets’ “max” function, which is a little tricky but very easy. This is demo.

  1. On first sheet, the first row should contain each column name. From the second row, you just fill resort name and amount of snow as data. you don’t need to care about order for data.

s 526

  1. On second sheet, the first row should contain each column name just same as the first sheet. Fill these function in A2.
  • sort data in from A2 to C100 on the first sheet
  • sort by 3rd column which means C, amount of snow
  • sort by descending order.

about max function:

s 527

it will be sorted automatically.

s 528

Also, when you add a new record for the first sheet, the second sheet will be updated automatically.

  1. use google sheet block and retrieve data by some key such as country in this example. Note: Google sheet block always returns a single record even if matches with more than 2 records. So this might be ok if you need just the highest record.

if you wanna do this in more database-y way, I recommend API Block and Airtable. In that way, you need to do some codes with code block to handle its data from Airtable, although.

1 Like

Hi. And thanks for the quick reply! This sounds like a good solution (as I‘m not the greatest in coding :crazy_face:). Will try it tomorrow.