openpyxl
не смог этого сделать. (Частично окрашен) .По тесту оказалось, что openpyxl
не получит цвет второй части.
Это example.xlsx
:
![enter image description here](https://i.stack.imgur.com/NP4cW.png)
If you read it by openpyxl
,like:
import openpyxl
from openpyxl.styles import Font, Color
wb = openpyxl.load_workbook('example.xlsx')
sheet = wb.active
print(sheet.cell(row=1, column=1).font.color)
Result:
Parameters:
rgb='FFFFFF00', indexed=None, auto=None, theme=None, tint=0.0, type='rgb'
There isn't the second color in the font.
Also, I tried to copy the style
of this cell to a new file,like:
import openpyxl, copy
from openpyxl.styles import Font, Color
wb = openpyxl.load_workbook('example.xlsx')
sheet = wb.active
sheet.cell(row=1, column=2, value="elon musk starlink").font = copy.copy(sheet.cell(row=1, column=1).font)
wb.save('output.xlsx')
still missed the color of the second part.
введите описание изображения здесь