Import data from google spreadsheet

Hello, I'm using of text blaze business currently.

I would like to import some data from my google spreadsheet which is continuously updated.
Please kindly find the attachments.


By pull-down function, when I select Brand A, then I would like to display Brand A's information as attached below.


I would appreciate it if you could let me know how to do it.

Hello Naoto,

You can achieve what you're looking for by following this guide. However, since that only shows you how to use it with a single-column format I've added the code below so support any amount of rows and columns.

Make sure to update the Google Sheets url to your own publicly available CSV file. Also note the preview below won't work since it can't connect to Google Sheets from here.

{note: preview=no}
{urlload:; done=(res) -> ["csv_data": res]}

{options=slice(split(catch(csv_data, ""), "\n"), 2)}
Labels minus the first one which is the brand name
{labels=slice(split(catch(split(catch(csv_data, ""), "\n")[1], ""), ","), 2)}
{optionsArray=map(options, (n, i) -> split(catch(n, ""), ","))}
{optionsbyindex=[option[1]: slice(option, 2) for option in optionsarray]}
{brandNames=map(optionsarray, (option, i) -> option[1])}
{endnote: trim=right}

{formmenu: values={=brandnames}; name=selectedBrand}

Selected brand: {=selectedbrand}
{repeat: for (label, index) in labels}
{=label}: {=optionsbyindex[selectedBrand][index]}