toggl2sheets

toggl entries to google sheets
git clone git://git.bain.cz/toggl2sheets.git
Log | Files | Refs | README

commit 5d3e3dd998a5ae9f64b1985a5ebdcddd96d06c20
parent d4bc9dd22a191a8da9152189e124e03d42a30c5a
Author: bain <bain@bain.cz>
Date:   Thu, 11 Aug 2022 23:47:35 +0200

sum whole columns, not only entries

Diffstat:
MREADME | 10++++++++++
Mtoggl2sheets.py | 6+-----
2 files changed, 11 insertions(+), 5 deletions(-)

diff --git 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 @@ -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