Import data from google spreadsheet

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: https://docs.google.com/spreadsheets/d/e/2PACX-1vTb4m7LqydZBVbHEuDtW0lQHy_pw7oIjJjMSnv7tYmpoQwSsfc0CDXePXgXs8ntGrKECSvtA2FEhyfq/pub?output=csv; 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]}
{endrepeat}