Masih
Masih

Reputation: 980

Merging Excel cells using Xlsxwriter in Python

I want to merge several series of cell ranges in an Excel file using Python Xlsxwriter, I found the Python command in the Xlsxwriter documentation in this website http://xlsxwriter.readthedocs.org/en/latest/example_merge1.html as below:

worksheet.merge_range('B4:D4')

The only problem is that I have my ranges in row and columns numbers format for example (0,0) which is equal to A1. But Xlsxwriter seems to only accept format like A1. I was wondering if anybody else had the same problem and if there is any solution for that.

Upvotes: 15

Views: 37454

Answers (1)

jmcnamara
jmcnamara

Reputation: 41594

Almost all methods in XlsxWriter support both A1 and (row, col) notation, see the docs. So the following are equivalent for merge_range():

worksheet.merge_range('B4:D4',    'Merged Range', merge_format)
worksheet.merge_range(3, 1, 3, 3, 'Merged Range', merge_format)

Upvotes: 27

Related Questions