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

27 lines
904 B
Python

import openpyxl, os, json
base = r'C:\Users\renet\.openclaw\workspace\buchhaltungs-app'
result = {'kredite': [], 'nebenkosten': [], 'planung': []}
for f in sorted(os.listdir(base)):
if not f.endswith('.xlsx'):
continue
fp = os.path.join(base, f)
size_mb = os.path.getsize(fp) / 1024 / 1024
if size_mb > 2:
print(f'SKIP (too large): {f} ({size_mb:.1f} MB)')
continue
try:
wb = openpyxl.load_workbook(fp, data_only=True, read_only=True)
print(f'\n=== {f} ===')
for sn in wb.sheetnames:
ws = wb[sn]
rows = []
for row in ws.iter_rows(max_row=60, values_only=True):
vals = [v for v in row if v is not None]
if vals:
rows.append(vals)
print(f' {vals}')
wb.close()
except Exception as e:
print(f'ERROR {f}: {e}')