diff --git a/README b/README index fd63619..13adceb 100644 --- a/README +++ b/README @@ -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. diff --git a/toggl2sheets.py b/toggl2sheets.py index 87033e2..6e517c6 100644 --- a/toggl2sheets.py +++ b/toggl2sheets.py @@ -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