21 lines
844 B
Python
21 lines
844 B
Python
import openpyxl, os
|
|
|
|
base = r'C:\Users\renet\.openclaw\workspace\buchhaltungs-app'
|
|
for f in os.listdir(base):
|
|
if f.endswith('.xlsx'):
|
|
fp = os.path.join(base, f)
|
|
print(f'\n{"="*60}')
|
|
print(f'FILE: {f}')
|
|
print(f'{"="*60}')
|
|
try:
|
|
wb = openpyxl.load_workbook(fp, data_only=True)
|
|
print(f'Sheets: {wb.sheetnames}')
|
|
for sn in wb.sheetnames:
|
|
ws = wb[sn]
|
|
print(f'\n Sheet "{sn}": {ws.max_row}r x {ws.max_column}c')
|
|
for row in ws.iter_rows(min_row=1, max_row=min(ws.max_row, 60), values_only=False):
|
|
vals = [(c.value, c.coordinate) for c in row if c.value is not None]
|
|
if vals:
|
|
print(f' {vals}')
|
|
except Exception as e:
|
|
print(f'ERROR: {e}') |