Skip to content

Commit

Permalink
committing the current changes under using_pip_openpyxl.py. was able …
Browse files Browse the repository at this point in the history
…to pick up the value for specific cell, familiarize with the built-in functions
  • Loading branch information
mynameisrhay committed Nov 5, 2023
1 parent 427b68c commit cd888b9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions using_pip_openpyxl.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit cd888b9

Please sign in to comment.