sum whole columns, not only entries

This commit is contained in:
bain 2022-08-11 23:47:35 +02:00
parent d4bc9dd22a
commit 5d3e3dd998
No known key found for this signature in database
GPG key ID: A708F07AF3D92C02
2 changed files with 11 additions and 5 deletions

10
README
View file

@ -11,3 +11,13 @@ The script operates based on project names. It will put all entries
that are a part of project "A" into a worksheet with with the name "A".
It can create new sheets when the project worksheet does not exist, or just
ignore it.
Example sheet:
Datum | Popis | 30 | Hodinovka | 138 Kč
1. 1. 2022 | (no description) | 15 | 69 Kč | 69 Kč
2. 1. 2022 | (no description) | 15 | 69 Kč | 69 Kč
In the sheet the first row is a header and there must not be any
breaks in the entries. toggl2sheets will find first empty row and insert
the new entries before it.

View file

@ -80,10 +80,6 @@ def append_hours(worksheet: Worksheet, data: List[List[str]]):
worksheet.insert_rows(last_row, len(d), d)
# inserting rows changes the top sums
worksheet.update_value("C1", f"=SUM(C2:C{last_row+len(d)})", True)
worksheet.update_value("E1", f"=SUM(E2:E{last_row+len(d)})", True)
def get_toggl_entries(
token: str, work_id: int, last_edit: datetime.datetime
@ -180,7 +176,7 @@ def main():
# create a new worksheet with a header
worksheet = sh.add_worksheet(key)
worksheet.insert_rows(
0, 1, [["Datum", "Popis", "0", "Hodinovka", "0,0 Kč"]]
0, 1, [["Datum", "Popis", "=SUM(C2:C)", "Hodinovka", "=SUM(E2:E)"]]
)
else:
continue