insert_rows() breaks the format
I tried to use the insert_rows()
with merged cells and with different height.
Here's the code:
import openpyxl
from io import BytesIO, StringIO
Excel = openpyxl.load_workbook(BytesIO(my_excel))
cellBookMarkNames = Excel.defined_names
for cellBookmark in cellBookMarkNames:
sheet = cellBookmark.attr_text.split("!")[0]
location = cellBookmark.attr_text.split("!")[1].replace("$","")
sheet2 = Excel[sheet]
sheet2.insert_rows(15, 2)
----- Other code -----
Excel.save('my_excel.xlsx')
Excel.close()
The problem is that when the cells bellow don't go with their corresponding style or format(height, bold, etc). I know that the new row won't have the style, but the cells that are below should preserve their format, right?
Edited by SystemError7