Hi, I’m wondering if there’s a way to populate the selection list for a (eg) multi-select dropdown field from an external api?
I can see it’s possible to manually bulk add options, but ideally I’d like to source/populate it via an external api so any new options get automatically updated (so client-side, I’m thinking)
Yes, here’s an example of how you can use logic to populate the options of a dropdown from an external service https://docs.feathery.io/platform/build-forms/logic/advanced/examples/api-connectors/dynamic-dropdown-options
1 Like
Thanks @peter ! My search-fu failed me
For reference only, in case someone runs across this:
Super simple rules example grabbing one column of data (with a heading) and populating a drop-down list (called Dropdown1
)
const response = await fetch('https://sheets.googleapis.com/v4/spreadsheets/SHEETS_ID/values/A2:A?key=API_KEY');
const names = await response.json();
Dropdown1.options = names.values.flat(1);
The datais returned as a 2d array, in this example using flat(1)
is a really simple way to get it formatted for use, note that it will not work with multiple columns though.