Python Forum
Can you help me to merge the cells with OpenPyXL?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can you help me to merge the cells with OpenPyXL?
#1
Hi guys,

from the documentation, I already know how to merge cells in Excel, but I need your help because I can't create a kind of table. below an example:

[Image: d1a04b1368591287.jpg]

if I have to add four columns, the result has to be like shown in the image (the merge of the cells depends by the result of the 2**n).

I wrote only the body of the code, but the main part it's difficult to implement. can you help me to write it?

import openpyxl

wb=openpyxl.Workbook()
ws=wb.active
ws.title="TEST"

..
..

wb.save(test.xlsx)
Reply
#2
I suggest that you take a look at some samples
here's a pretty good set: https://www.programcreek.com/python/exam...2/openpyxl
then try again, and ask for help specifically where needed.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Openpyxl-change value of cells in column based on value that currently occupies cells phillipaj1391 5 9,568 Mar-30-2022, 11:05 PM
Last Post: Pedroski55
  How can I iterate through all cells in a column (with merge cells) with openpyxl? aquerci 1 7,442 Feb-11-2021, 09:31 PM
Last Post: nilamo
  [openpyxl] Increment cells being pasted into Template Kristenl2784 4 3,507 Jul-16-2020, 10:00 PM
Last Post: Kristenl2784
  Copy certain cells into new workbook certain cells Kristenl2784 4 2,446 Jul-14-2020, 07:59 PM
Last Post: Kristenl2784
  openpyxl Pasting data to different cells Kristenl2784 3 7,552 Jun-15-2020, 08:50 PM
Last Post: Yoriz
  coloring cells in a row with openpyxl curranjohn46 3 7,017 Oct-08-2019, 11:46 AM
Last Post: curranjohn46
  Openpyxl, format color of cells (cols) based on condition. genderbee 0 8,036 Sep-11-2019, 01:05 PM
Last Post: genderbee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020