Answer the question
In order to leave comments, you need to log in
Python, openpyxl module: When writing to an Excel file, how not to remove the outlined borders of a merged cell?
How in Python, using the openpyxl module, when writing a value to an Excel file, do not violate the outlined boundaries of the merged cell?
For example, in the Excel file 'report.xlsx', cells "A1:A2" are merged and a frame (border) is drawn around this merged cell, and cell "C1" is not merged with anyone, but its borders are also outlined.
When writing data to these cells, the border of the "C1" cell remains the same, but the border of the merged cell is violated. Can you please tell me if this "border violation" can be avoided?
Archive with an example: https://yadi.sk/d/LzDQOoca3Y2bim
from openpyxl import Workbook, load_workbook
wb = load_workbook('report.xlsx')
ws = wb.active
ws.title = 'test'
ws['A1'] = "Границы удаляются"
ws['C1'] = "Границы не удаляются"
wb.save('report.xlsx')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question