Skip to content

Commit

Permalink
feat: style first row according to suisa template (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
spameier authored Feb 22, 2023
1 parent 8a6a893 commit f85d124
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions suisa_sendemeldung/suisa_sendemeldung.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from dateutil.relativedelta import relativedelta
from iso3901 import ISRC
from openpyxl import Workbook
from openpyxl.styles import Border, Font, PatternFill, Side

from .acrclient import ACRClient

Expand Down Expand Up @@ -567,6 +568,18 @@ def get_xlsx(data, station_name=""):
for row in csv_reader:
worksheet.append(row)

# the columns that should be styled as required (grey background)
required = ["A", "B", "C", "F", "G", "H", "I", "K", "W", "Y"]
font = Font(name="Calibri", bold=True, size=12)
side = Side(border_style="thick", color="000000")
border = Border(top=side, left=side, right=side, bottom=side)
fill = PatternFill("solid", bgColor="d9d9d9", fgColor="d9d9d9")
for cell in worksheet[1]: # xlsx is 1-indexed
cell.font = font
cell.border = border
if cell.column_letter in required:
cell.fill = fill

# POST PROCESSING
dims = {}
for row in worksheet.rows:
Expand Down

0 comments on commit f85d124

Please sign in to comment.