Initial commit - Stand 26.04.2026
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
import openpyxl
|
||||
import json
|
||||
|
||||
wb = openpyxl.load_workbook('Nebenkosten 2020.xlsx', data_only=True)
|
||||
|
||||
all_data = []
|
||||
|
||||
for sheet in wb.sheetnames:
|
||||
ws = wb[sheet]
|
||||
|
||||
year = None
|
||||
for y in ['2020', '2021', '2022', '2023', '2024']:
|
||||
if y in sheet:
|
||||
year = int(y)
|
||||
break
|
||||
|
||||
if not year:
|
||||
continue
|
||||
|
||||
mieter = None
|
||||
address = None
|
||||
|
||||
for row in ws.iter_rows(min_row=1, max_row=15, values_only=True):
|
||||
for cell in row:
|
||||
if cell and isinstance(cell, str):
|
||||
if 'Zingelstr. 14' in cell:
|
||||
address = 'Zingelstr. 14'
|
||||
elif 'Zingelstr. 7' in cell or 'Zingelstr.7' in cell:
|
||||
address = 'Zingelstr. 7'
|
||||
elif 'Ahornweg 6' in cell:
|
||||
address = 'Ahornweg 6'
|
||||
|
||||
if 'Krohn' in cell and 'Welling' in cell:
|
||||
mieter = 'Johanna Krohn / Tobias Welling'
|
||||
elif 'Körger' in cell or 'K�rger' in cell:
|
||||
mieter = 'Kevin Körger'
|
||||
elif 'Brandt' in cell and 'Yvonne' in cell:
|
||||
mieter = 'Yvonne Brandt'
|
||||
|
||||
if not mieter or not address:
|
||||
continue
|
||||
|
||||
positions = {}
|
||||
for row in ws.iter_rows(min_row=7, max_row=30, values_only=True):
|
||||
if not row or not row[0]:
|
||||
continue
|
||||
|
||||
pos_name = str(row[0]).strip()
|
||||
|
||||
betrag = None
|
||||
if len(row) > 10 and row[10] and isinstance(row[10], (int, float)):
|
||||
betrag = round(row[10], 2)
|
||||
elif len(row) > 5 and row[5] and isinstance(row[5], (int, float)):
|
||||
betrag = round(row[5], 2)
|
||||
|
||||
if betrag:
|
||||
positions[pos_name] = betrag
|
||||
|
||||
all_data.append({
|
||||
'sheet': sheet,
|
||||
'year': year,
|
||||
'mieter': mieter,
|
||||
'address': address,
|
||||
'positions': positions
|
||||
})
|
||||
|
||||
zingelstr14 = [d for d in all_data if d['address'] == 'Zingelstr. 14']
|
||||
|
||||
print('=== DATEN FUER ZINGELSTR. 14 ===')
|
||||
for d in zingelstr14:
|
||||
print(f"\n{d['sheet']}: {d['mieter']} ({d['year']})")
|
||||
print(f" Positionen: {len(d['positions'])}")
|
||||
for pos, val in d['positions'].items():
|
||||
print(f" - {pos}: {val}")
|
||||
|
||||
with open('nebenkosten_zingelstr14.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(zingelstr14, f, indent=2, ensure_ascii=False)
|
||||
|
||||
print(f"\nGesamt: {len(zingelstr14)} Eintraege")
|
||||
print('Gespeichert in nebenkosten_zingelstr14.json')
|
||||
Reference in New Issue
Block a user