Files
fundobiblico_rpa/read_xlsx.py

28 lines
819 B
Python

import openpyxl
# Read Vendas
wb = openpyxl.load_workbook('FundoBiblicoVendasv2.xlsx')
ws = wb.active
print("=" * 80)
print(f"VENDAS - Sheet: {ws.title} | Rows: {ws.max_row} | Cols: {ws.max_column}")
print("=" * 80)
headers = [cell.value for cell in ws[1]]
print(f"Headers: {headers}")
print("-" * 80)
for row in ws.iter_rows(min_row=2, max_row=ws.max_row, values_only=True):
print(list(row))
print("\n\n")
# Read Lancamentos
wb2 = openpyxl.load_workbook('FundoBiblicoLancamentos.xlsx')
ws2 = wb2.active
print("=" * 80)
print(f"LANCAMENTOS - Sheet: {ws2.title} | Rows: {ws2.max_row} | Cols: {ws2.max_column}")
print("=" * 80)
headers2 = [cell.value for cell in ws2[1]]
print(f"Headers: {headers2}")
print("-" * 80)
for row in ws2.iter_rows(min_row=2, max_row=ws2.max_row, values_only=True):
print(list(row))