How To Create Dropdown From Google Sheet

Hi,

I am looking to pull an account list from a google sheet and then display that data in a drop down list.

Is it possible to use the list from the Google sheet query as the display text in a dropdown?

Thanks!

Hi!

That certain sounds possible! Is your question primarily about integrating with Google Sheet, or Dropdown Menus? If the latter, this doc might be a good place to start. If the former, can you go into a little more detail on what you’ve set up so far?

1 Like

Here is what I have tried so far.

I think my data binding for the dropdown list isn’t correct?


image

Within the Dropdown Menu Inspector, under Display Text, change it from

accountlist[*]

to

item

and see what displays then.

(When looping through Lists, each item in the list is referenced under the item namespace. If you’re looping through a List of Objects, you can reference the value of the that attribute in each Object in the List as item.attribute.)

1 Like

I think there might be an issue with my list.

I noticed in the example doc the values are all in one bracket, while my list has brackets for each. Could that be the issue?

image

Oh, yes, that can certainly be part of it! What you have here is a List of Lists, and each List in that List contains a single string.

You can reference the first item in a List while looping through a List by using

item[0]

which goes through each item (a List) in that List (of Lists), and returns the first item (in this case, a string) in the List (of strings).

You can also modify the List of Lists with the FLAT function.

1 Like

Used the FLAT function to modify the list.

image

I tried both item[0] before using FLAT and item after flattening the list.

I also added a label to display the list just to make sure the data flow was running.
image
image

You might need to change the output type from “Text” to “Any”. Right now it looks like your array is outputted as a string.

1 Like

Is the output type the section at the end of the data flow?

image

That was “any”. Should the variable type be text, list of text, or any?

Got it, switched the activity group variable to “list of any” and now it works.

Thanks everyone!

1 Like