Drop down that reads dynamically from google sheets

Hi, I have a question regarding accessing data from a google sheet column dynamically in a drop down.
In the Values field:
{{get_member.data.name}} returns no data.
{{get_member.data}} returns an array of member objects, so how can I get just the ‘name’ of all the members in a front end drop down?

Please suggest.


Hi @ppatel!

You might have an array of objects here, which is a different data structure than SQL will return. Does this post help with this? How to prefill the content of dropdown from a query?

Copying here for convenience :grin:
Some queries (usualy SQL based ones) return data as an object of arrays like this:
{ key1: [val, val], key2: [val, val] }

Which would make the selection of all of the values in an array easy as shown above, queryName.data.key1.

Many other data sources return an array of objects like this:
[ { key1: val, key2: val }, { key1: val, key2: val } ]

For this, you could either get the array of all of a certain value by using the .map() JS method, or converting it to an object of arrays using our helper function formatDataAsObject() (there’s also the opposite as formatDataAsArray). That would look like either:


So for Datasource type - google sheets,
where (what property in the form ) and in what syntax will we use the conversion of an array of objects that looks like the format:
[ { key1: val, key2: val }, { key1: val, key2: val } ]
to an array of strings which for eg is all key2.

Please advise

Does {{ get_member.data.map(member=>member.name) }} in the Values setting of the dropdown work?

1 Like

thanks a lot it worked!!