google-apps-scriptgoogle-sheetsdropdownpage-break

Adding Line Break on Multi-Select Dropdown in Google Sheets


I have an order tracking sheet I made in Google Sheets. I have an Items column with a dropdown populated from an Items List sheet, and I used this answer to setup the multi select function, and it works great.

Here's my to actual code

The only issue I have is the items are separated by , in the cell, but the line breaks are not by item, just based on line length overall, there is too much variation to just adjust the column width. I would like each item to be on their own line within the one cell, essentially having a line break after each item is selected.

Currently I get this:

Item 1, Item 2, Item
3, Item 4

I would like:

Item 1
Item 2
Item 3
Item 4

I found a part in the code where it adds the , after each item and I can change the comma to something else, but I don't know how to make a break there.

I tried \n, <br>, etc. I am assuming I am just putting the break in the wrong place?


Solution

  • https://gist.github.com/coinsandsteeldev/4c67dfa5411e8add913273fc5a30f5e7#file-multi-select-gs-L26

    Change to var separator = '\n'