How do I know if spreadsheet cells are merged using google apps script

后端 未结 9 1251
予麋鹿
予麋鹿 2020-12-01 17:10

In a Google docs spreadsheet. If cells A1 & A2 are merged, is there a way to confirm they are merged, using google apps script?

There is a merge function in GAS

9条回答
  •  不思量自难忘°
    2020-12-01 17:30

    Yes, now you can use isPartOfMerge to check.

    And for anyone wants to get the value of merged cell:

    var value = (cell.isPartOfMerge() ? cell.getMergedRanges()[0].getCell(1,1) : cell).getValue();
    

    Hope it help.

提交回复
热议问题