I created an array containing multiple rows and columns. In column B, I have the type of vegetables, and in column c, the varieties. In the array, there is an automatic sorting which is carried out in column B then column c.
Is it possible to merge automatically the cells of column B containing the same type?
I just know how to merge a range with :
var range1 = sheet.getRange("b4:b9");
range1.merge();
Cordially.
How about this sample script? I think that there are several answers for this situation, so please think of this as one of them. The flow of this script is as follows.
Flow :
Sample script :
Result :
Note :
Composées, Cucurbitacées, Légumineuses, Liliacées, Solanacées
. On the other hand, the order of "Wish" isComposées, Cucurbitacées, Légumineuses, Solanacées, Liliacées
.Liliacées, Solanacées
andSolanacées, Liliacées
.Reference :
If I misunderstand your question, I'm sorry.
Edit 1 :
For your next question, I think that the following flow can achieve what you want. But I think that there may be other solution.
breakApart()
."sample", "sample", "sample"
. When this merged cell is broken usingbreakApart()
, each value of "A1:A3" retrieved bygetValues()
becomes[["sample"],[""],[""]]
.breakApart()
.Reference :
Edit 2 :
Usage of breakApart():
If you want to break "B1:B", please use as follows.