A
A
Alexander Nimgirov2021-06-23 15:52:14
Google Apps Script
Alexander Nimgirov, 2021-06-23 15:52:14

How to merge cells in a Google Docs table using Apps Script?

Hello, I'm trying to merge several cells in a table. But instead of the desired result, I get the inexplicable.

I have a table with 4 columns. Tried to merge two sibling cells into one using the .merge() method - Link to documentation

But instead of merging them, the script just hides one of them and this is the result:

60d32e7a959bc142999405.png

What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mityayka1, 2021-06-26
@Xolodeec

When you merge elements, the element on which the .merge() method is called is removed. Which, in fact, is shown in your image.
60d655931d9f4632326084.png
If, instead of the element removed during the merging, another (new) element is added, then everything falls into place.
60d656d94e3a4265240916.png
60d6571c0a928222289563.png
Read the documentation carefully.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question