# How to merge cells between rows?

**URL:** <https://community.plotly.com/t/how-to-merge-cells-between-rows/31475>\
**Category:** Dash Python\
**Created:** [November 18, 2019, 6:48am UTC](https://community.plotly.com/t/how-to-merge-cells-between-rows/31475 "2019-11-18T06:48:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![richard\_hi](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@richard\_hi](https://community.plotly.com/u/richard_hi)\
**Post date:** [November 18, 2019, 6:48am UTC](https://community.plotly.com/t/how-to-merge-cells-between-rows/31475/1 "2019-11-18T06:48:12Z")

</div>

Hi there!  
When using dash\_table, I know we can merge data table header with “merge\_duplicate\_headers”. But what if I want to merge cells in different rows? Just as what we do in Excel:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/e/e8b1c74f213c6579efdb9687cd317261a53ac160.png)

---

<div class="post-metadata">

**Author:** ![Blaceus](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/blaceus/32/2992_2.png) [@Blaceus](https://community.plotly.com/u/Blaceus)\
**Post date:** [November 18, 2019, 7:21am UTC](https://community.plotly.com/t/how-to-merge-cells-between-rows/31475/2 "2019-11-18T07:21:57Z")

</div>

In the given Th/Td, write in the property “rowspan” or “colSpan” to dictate how many rows or columns the cell should span over.

In your case you would have something like:

```auto
html.Tr(
   [
      html.Td('Group 1', rowSPan=2),
      html.Td(1),
      html.Td(2),
      html.Td(3),
   ]
),
html. Tr(
 [ 
      html.Td(1),
      html.Td(2),
      html.Td(3),
   ]
)

```

Note that there is only 3 entries in the second html.Tr().

---

<div class="post-metadata">

**Author:** ![richard\_hi](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@richard\_hi](https://community.plotly.com/u/richard_hi)\
**Post date:** [November 18, 2019, 8:37am UTC](https://community.plotly.com/t/how-to-merge-cells-between-rows/31475/3 "2019-11-18T08:37:21Z")

</div>

Thanks fir the solutions. I forgot to mention that I were using the dash package dash\_table…

---

<div class="post-metadata">

**Author:** ![Blaceus](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/blaceus/32/2992_2.png) [@Blaceus](https://community.plotly.com/u/Blaceus)\
**Post date:** [November 18, 2019, 9:04am UTC](https://community.plotly.com/t/how-to-merge-cells-between-rows/31475/4 "2019-11-18T09:04:43Z")

</div>

I am unsure whether or not row/col span has been implemented in the dash\_table component yet.  
I can find an old thread about this where it is mentioned to include this, but I cannot see anything which resembles this in the documentation for dash\_table.

> [@Dash DataTable - Cells with multiple lines](https://community.plotly.com/t/dash-datatable-cells-with-multiple-lines/7618):
>
> One question about row height. Is it possible to show multiple lines on the same cell instead of a row with all the text? By setting a higher row height can I get this? I was trying with “\n” on the string but no luck. Thank you!

---

<div class="post-metadata">

**Author:** ![alexcjohnson](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/alexcjohnson/32/614_2.png) [@alexcjohnson](https://community.plotly.com/u/alexcjohnson)\
**Post date:** [November 18, 2019, 5:37pm UTC](https://community.plotly.com/t/how-to-merge-cells-between-rows/31475/5 "2019-11-18T17:37:22Z")

</div>

Ah yeah, there’s no row equivalent of `merge_duplicate_headers` in `dash_table` right now. New issue: [https://github.com/plotly/dash-table/issues/645](https://github.com/plotly/dash-table/issues/645)

---

<div class="post-metadata">

**Author:** ![richard\_hi](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@richard\_hi](https://community.plotly.com/u/richard_hi)\
**Post date:** [November 28, 2019, 9:13am UTC](https://community.plotly.com/t/how-to-merge-cells-between-rows/31475/6 "2019-11-28T09:13:48Z")

</div>

Thx! Hope the function will be added…

---

<div class="post-metadata">

**Author:** ![chriswatson](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@chriswatson](https://community.plotly.com/u/chriswatson)\
**Post date:** [June 7, 2020, 7:42pm UTC](https://community.plotly.com/t/how-to-merge-cells-between-rows/31475/7 "2020-06-07T19:42:23Z")

</div>

Wow, all the posts are nice. I have got my answer. Well before this thread, I found this article helpful to [merge cell between rows in google sheets](https://thetechvin.com/how-to-merge-cells-in-google-sheets/). I am a programmer so sometimes the source code works. Well, thank you so much for this helpful thread. You cleared all my queries. So thank you very much. 🙂
