From e345e477d36987ffb10056f822f1b4794e015870 Mon Sep 17 00:00:00 2001 From: Vladimir Buzalka Date: Tue, 10 Mar 2026 17:34:29 +0100 Subject: [PATCH] Rename report file and auto-delete previous reports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename output to "YYYY-MM-DD HH-MM-SS Agenda + Požadavky.xlsx" - Delete old reports before generating new one Co-Authored-By: Claude Opus 4.6 --- 40 agenda a požadavky/871 test.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/40 agenda a požadavky/871 test.py b/40 agenda a požadavky/871 test.py index da0d6b0..6134a59 100644 --- a/40 agenda a požadavky/871 test.py +++ b/40 agenda a požadavky/871 test.py @@ -40,8 +40,14 @@ DB_CONFIG = { EXPORT_DIR = Path(r"z:\Dropbox\Ordinace\Reporty") EXPORT_DIR.mkdir(exist_ok=True, parents=True) -timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") -xlsx_path = EXPORT_DIR / f"{timestamp} Agenda + Pozadavky (Merged).xlsx" + +# Delete previous reports +for old in EXPORT_DIR.glob("* Agenda + Požadavky.xlsx"): + old.unlink() + print(f"🗑️ Deleted old report: {old.name}") + +timestamp = datetime.now().strftime("%Y-%m-%d %H-%M-%S") +xlsx_path = EXPORT_DIR / f"{timestamp} Agenda + Požadavky.xlsx" # ==================== LOAD TOKEN ==================== TOKEN_PATH = Path("token.txt")