Multiple Selectors are adding each item selected as its own row in Google Sheets

I am using {{form1.data}} and my multiple selector is placing each item on its own line. The end goal is a comma separated list of values going into a single cell.

I am unsure how to resolve this, but I am happy to provide more information if this isn't enough to know what is causing the issue. Thank you!


Hi @samk,

You can open the left panel (cmd+b on mac) to view what kind of data structure you are manipulating. With "values to append" input, I would suggest you handle them per column on your sheet. So for your multiselect, you would do something like:

{
  multiselect1: {{ form1.data.multiselect1.reduce((x,y)=> x + "," + y) }},
  location_name: {{form1.data.locationName}}
  //and so forth
}

JSON output:
{
  multiselect1: "foo,bar,baz",
  location_name: "" //since there's no component but giving you an idea on how you should map this JSON to the sheet you want to update.
}

Just to answer the issue you have there, the behaviour of your append data to gsheet is that you are passing this one below instead of the one above:

{
  multiselect1: [foo, bar, baz]
}

Hence you get three individual entries on your sheet. Let me know if this helps.

Regards

Oh man, that is so helpful! I didn't realize I was missing a panel, thank you!

That answer not only resolved the question but taught me I can append data column by column.

Thank you for your help, this is going to make my job a heck of a lot easier!

Hi @jocen

Your previous help got me almost all the way to the end of my first application, but I ran into an issue I'm not sure how to troubleshoot here.

I got a few multi-option items to work, but after a certain point, no new fields are being recognized by Values to Append.

In this example, I have the amenities_checkbox checkbox group. It appends perfectly to the google sheet. I copied the element, renamed it as amenities_checkbox2, and now Values to Append won't acknowledge it exists. I get the autocomplete when typing "amenities_checkbox" but no amenities_checkbox2 appears as shown below.


the full text of the error: {"message":"Cannot read properties of undefined (reading 'reduce')","payload":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true]}

In another example, I added a field textInput1 to the form, added textInput1 to my google sheet, and typed {{form1.data.textInpu }} but as expected, Retool didn't recommend textInput1. When the form submits, nothing appears in column textInput1.

I've tried closing the tab and reopening, checking for duplicate column headings, adding fields up in the header of the application, etc. to pinpoint where I'm going wrong, but I'm stumped. I'm hoping someone may have an idea of what I did wrong here.

Thank you again for your help.

Hi @samk, did you put amenities_checkbox2 inside another component? Open the left panel to view your form data and check how deep your amenities_checkbox2 is located. If it is not shown in your form1.data, then you can refer directly to the checkbox component itself; i.e. amenities_checkbox2.values.reduce(...).

Lemme know if that helps