Merging combines two or more cells to create a new, larger cell. This is a great way to create a label that spans several columns.
Use the addSpan method to merge cells in a specified range to a new, larger cell, as shown in the following code.
// Merge cells and set label
sheet.addSpan(1, 4, 1, 7);
sheet.setValue(1, 4, "Goods");
// Merge cells across multi rows (3) and columns (4)
sheet.addSpan(20, 1, 3, 4);
Use the removeSpan method to remove the span that contains the specified cell.
Change the allowUserDragMerge property to allow or not allow merging cells via dragging the mouse. If allowUserDragMerge is set to true, there will be an indicator in the selection border of the cell.
// default value is false
spread.options.allowUserDragMerge = true;
Note: Make sure the data you want to display in the merged cell is in the upper-left cell. All data in the other merged cells will be hidden until the span is removed.