You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
718 B
30 lines
718 B
# /usr/bin/python3
|
|
|
|
import json
|
|
import datetime
|
|
from pprint import pprint
|
|
|
|
from pyexcel_ods import get_data
|
|
# https://pythonhosted.org/pyexcel-ods/
|
|
|
|
from jinja2 import Template
|
|
# https://jinja.palletsprojects.com/en/2.11.x/api/#jinja2.Environment
|
|
|
|
t = open('template.html', 'r').read()
|
|
template = Template(t)
|
|
year = datetime.date.today().year
|
|
filename = 'varia-financial-spreadsheets-{}.ods'.format(year)
|
|
|
|
ods = get_data(filename)
|
|
string = json.dumps(ods)
|
|
data = json.loads(string)
|
|
commonfund = data['Common Fund']
|
|
Q1 = data['Q1']
|
|
Q2 = data['Q2']
|
|
Q3 = data['Q3']
|
|
Q4 = data['Q4']
|
|
|
|
page = template.render(data=commonfund, Q1=Q1, Q2=Q2, Q3=Q3, Q4=Q4, year=year)
|
|
out = open('index.html', 'w+')
|
|
out.write(page)
|
|
out.close()
|
|
|