22 lines
808 B
Python
22 lines
808 B
Python
import openpyxl, os
|
|
|
|
fp = r'C:\Users\renet\.openclaw\workspace\buchhaltungs-app'
|
|
# Find Nebenkosten file
|
|
for f in os.listdir(fp):
|
|
if f.endswith('.xlsx') and 'ebenko' in f.lower():
|
|
full = os.path.join(fp, f)
|
|
print(f'Reading: {f}')
|
|
wb = openpyxl.load_workbook(full, data_only=True, read_only=True)
|
|
print(f'Sheets: {wb.sheetnames}')
|
|
for sn in wb.sheetnames[:3]: # max 3 sheets
|
|
ws = wb[sn]
|
|
print(f'\n Sheet "{sn}":')
|
|
count = 0
|
|
for row in ws.iter_rows(max_row=40, values_only=True):
|
|
vals = [v for v in row if v is not None]
|
|
if vals:
|
|
print(f' {vals}')
|
|
count += 1
|
|
if count == 0:
|
|
print(' (empty)')
|
|
wb.close() |