Search code examples
pythonxlwings

xlwings: how to merge cells


I'm trying to merge cells together using the code below as suggested in the xlwings github, but it seems to stuck in some process for a very long time (around 10 minutes before I cancel it)

import xlwings as xw
wb = xw.Book('test_merge_cells.xlsx')
ws = wb.sheets['Sheet1']
ws.range('A1:A5').api.merge() # this line is stuck in a process

Versions used:
python 3.7.11
xlwings 0.24.7

The official doc also writing the same method to merge cells. But I still can't do it. Is it because I'm using different package version?

Tq in advance


Solution

  • Remove the “.api” from your code. That is only required for things that are not natively supported.