2

I am trying to merge 4 columns in a row of an excel file. This link has some suggestions on how to do it for two rows: How to write a cell with multiple columns in xlwt? The line it uses to merge two columns and two rows:

sheet.write_merge(0, 0, 0, 1, 'Long Cell')

However, the same code syntax does not work when i try to merge 4 rows only. My code:

sh.write_merge(0,4,0,5,0,6,0,7,'Start point\nCo-ordinates')

I basically need something like this.

Matt Ellen
  • 11,268
  • 4
  • 68
  • 90
Eshant
  • 75
  • 1
  • 10

1 Answers1

3

maybe this?

sh.write_merge(0, 0, 4, 7, 'Start point\nCo-ordinates')
buran
  • 13,682
  • 10
  • 36
  • 61
  • Not working. That merges first 5 rows and first 8 columns. i just need to merge column 5,6,7 and 8 in the first row as shown in the image attached in my question ! – Eshant Dec 09 '18 at 12:29
  • @Eshant, my error, I edited the code accordingly. I had swaped r2 and c1. i.e. the order should be r1, r2, c1, c2. In your case r1=r2=0, c1=4, c2=7 – buran Dec 09 '18 at 12:39