27 lines
909 B
Python
27 lines
909 B
Python
import openpyxl, os
|
|
|
|
base = r'C:\Users\renet\.openclaw\workspace\buchhaltungs-app'
|
|
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
|
|
print(f'\n{"="*60}')
|
|
print(f'FILE: {f} ({size_mb:.1f} MB)')
|
|
try:
|
|
wb = openpyxl.load_workbook(fp, data_only=True, read_only=True)
|
|
print(f'Sheets: {wb.sheetnames}')
|
|
for sn in wb.sheetnames:
|
|
ws = wb[sn]
|
|
print(f'\n Sheet "{sn}":')
|
|
count = 0
|
|
for row in ws.iter_rows(max_row=25, values_only=True):
|
|
vals = [v for v in row if v is not None]
|
|
if vals:
|
|
print(f' {vals}')
|
|
count += 1
|
|
if count >= 20:
|
|
break
|
|
wb.close()
|
|
except Exception as e:
|
|
print(f'ERROR: {e}') |