From cd888b9a8adfd3d4e827390ee4edefa0c70e00fb Mon Sep 17 00:00:00 2001 From: Raymond Bautista Date: Sun, 5 Nov 2023 19:47:54 +0800 Subject: [PATCH] committing the current changes under using_pip_openpyxl.py. was able to pick up the value for specific cell, familiarize with the built-in functions --- using_pip_openpyxl.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/using_pip_openpyxl.py b/using_pip_openpyxl.py index e69de29..730a747 100644 --- a/using_pip_openpyxl.py +++ b/using_pip_openpyxl.py @@ -0,0 +1,17 @@ +import openpyxl as xl +wb = xl.load_workbook("transactions.xlsx") +sheet = wb['Sheet1'] +cell = sheet.cell(1, 1) +print(f'Cell value of A1 is {cell.value}') +cell = sheet.cell(1, 2) +print(f'Cell value of B2 is {cell.value}') +# cell = sheet.cell(X or column, Y or row) + +max_row = sheet.max_row +print(f'''Max row for this spreadsheet is {max_row} +''') + +print("will reiterate the contents of C2 to C4 cells below:") +for row in range(2, max_row + 1): + cell = sheet.cell(row, 3) + print(cell.value)