Skip to content

Instantly share code, notes, and snippets.

@DuqueDeTuring
Created May 25, 2020 20:38
Show Gist options
  • Save DuqueDeTuring/17dcfc44b8a2b561f3ff4302ae35ad75 to your computer and use it in GitHub Desktop.
Save DuqueDeTuring/17dcfc44b8a2b561f3ff4302ae35ad75 to your computer and use it in GitHub Desktop.
nombre_archivo = "blah.xlsx"
wb = Workbook()
ws1 = wb.active
ws1.title = titulo
header = NamedStyle(name="header")
header.font = Font(bold=True)
header.border = Border(bottom=Side(border_style="thin"))
header.alignment = Alignment(horizontal="center", vertical="center")
for i in range(len(columnas)):
col = i + 1
titulo = columnas[i][0]
cell = ws1.cell(column=col, row=1, value=titulo)
cell.style = columnas[i][1]
ws1.column_dimensions[get_column_letter(col)].width = len(titulo)
row_excel = 2
for l in lineas:
for i in range(len(l)):
col = i + 1
cell = ws1.cell(column=col, row=row_excel, value=l[i])
cell.style = columnas[i][1]
row_excel += 1
wb.save(filename=dest_filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment