Files
buchhaltung/extract_heizung_muell.py
2026-04-26 07:51:39 +02:00

34 lines
1.4 KiB
Python

import openpyxl
from openpyxl import load_workbook
file_path = r"C:\Users\renet\.openclaw\workspace\buchhaltungs-app\Nebenkosten 2020.xlsx"
wb = load_workbook(file_path, data_only=True)
sheets = ['Körger 2020', 'KrohnWelling 2020', 'Körger 2021', 'KrohnWelling 2021',
'Körger 2022', 'KrohnWelling 2022', 'KrohnWelling 2023', 'Körger 2023)', 'Brandt 2023', 'Brandt 2024']
print("Heizkosten und Müll aus allen Sheets:\n")
for sheet_name in sheets:
if sheet_name in wb.sheetnames:
ws = wb[sheet_name]
print(f"=== {sheet_name} ===")
# Zeilen 13-25 nach Heizung und Müll suchen
for row in range(13, 26):
cell_a = ws.cell(row=row, column=1).value
cell_b = ws.cell(row=row, column=2).value # Gesamtkosten
cell_k = ws.cell(row=row, column=11).value # Ihr Anteil (Spalte K)
if cell_a and ('heiz' in str(cell_a).lower() or 'Heiz' in str(cell_a)):
print(f" Zeile {row}: {cell_a}")
print(f" Gesamtkosten: {cell_b}")
print(f" Anteil: {cell_k}")
if cell_a and ('müll' in str(cell_a).lower() or 'Müll' in str(cell_a) or 'muell' in str(cell_a).lower()):
print(f" Zeile {row}: {cell_a}")
print(f" Gesamtkosten: {cell_b}")
print(f" Anteil: {cell_k}")
print()