-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxlsx2md.py
35 lines (30 loc) · 1.28 KB
/
xlsx2md.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pandas as pd
import sys
file = sys.argv[1]
df = pd.read_excel(file, "Cronograma", keep_default_na=False)
print('{: style="border-collapse: collapse; width: 100%; text-align: center;" border="1"}')
print('| Data | Atividade | Entrega')
print('|---')
for index, row in df.iterrows():
date = pd.to_datetime(row['Data'], errors='coerce').strftime('%d/%m/%Y')
activity = row['Atividade']
task = row['Entrega']
if not pd.isnull(activity) and activity.strip():
# Blue for exams
if activity.startswith(('Prova', 'Segunda chamada', 'Verificação suplementar')):
color = 'blue'
# Green for assignment presentations
elif activity.startswith('Apresentações de trabalhos'):
color = 'green'
# Black for activities that should not be highlighted, but should be shown
elif activity.startswith('Apresentações de artigos'):
color = 'black'
# Red for optional activities and no class
elif activity.startswith(('Sem aula', 'Vista de prova', 'Vista de avaliações')):
color = 'red'
else:
color = None
if color:
print(f'| {date} | <span style="color:{color}">{activity}</span> | {task}')
else:
print(f'| {date} | Aula | {task}')