I'm working on a project where i store my earnings classified by columns in an excel sheet.
every time i get a payment i add it to the excel sheet using python openpyxl library.
regardless of what the program is, im trying to add the payment to the last row of a COLUMN, for example if i have column 1 (payment1) with 10 rows, and column 2 (payment2) with 3 rows and i try to add a cell to the last row of column 2 then it will add the cell on the 11th row of column 2 even though rows 3 to 10 of column 2 are blank.
what i want to do is to have the cell added to the first blank row of a certain column whether if column 1 has 100 rows or not.
I tried ws.max_row but that return same problem and i tried len(ws[column 2]) which returns the cells even if they were blank but filled in another column.
import openpyxl
wb = openpyxl.Workbook()
ws = wb.active
mydict = {'A': 'pay1', 'B': 'pay2', 'C': 'pay3'}
for k, v in mydict.items():
ws[k + '1'] = v
for i in range(1, 10):
ws.cell(i, 1, i)
print(len(ws['B'])) # would return max_row
This code is just an example to clarify what the problem is.
Thank you in advance!