Quiero abrir un archivo .xlsx y modificarlo con Python y openpyxl quiero cambiarle el tipo de letra, etc. El problema que me da un error y no he podido solucionarlo este es el error que me da:
Éste es mi código:
from openpyxl.reader.excel import load_workbook
from openpyxl.workbook import Workbook
from openpyxl.styles import Color, Fill
from openpyxl.cell import Cell
from openpyxl import load_workbook
wb = load_workbook('C:/Users/angel.torreso/Documents/Prueba2.xlsx')
ws = wb.active
_cell = ws.cell('A1')
_cell.style.font.color.index = Color.GREEN
_cell.style.font.name = 'Arial'
_cell.style.font.size = 8
_cell.style.font.bold = True
_cell.style.alignment.wrap_text = True
_cell.style.fill.fill_type = Fill.FILL_SOLID
_cell.style.fill.start_color.index = Color.DARKRED
wb.save("C:/Users/angel.torreso/Documents/Prueba2.xlsx")
class Color(HashableObject):
"""Named colors for use in styles."""
BLACK = 'FF000000'
WHITE = 'FFFFFFFF'
RED = 'FFFF0000'
DARKRED = 'FF800000'
BLUE = 'FF0000FF'
DARKBLUE = 'FF000080'
GREEN = 'FF00FF00'
DARKGREEN = 'FF008000'
YELLOW = 'FFFFFF00'
DARKYELLOW = 'FF808000'
Espero me puedan ayudar gracias