I have an excel file that looks like this (example) [Balance Sheet][1] [1]: https://i.stack.imgur.com/O0WXP.jpg I would like to extract all the items of this financial statement and write it to a new excel sheet. The output that I want is that all accounts under one column, and all the corresponding numbers in another column [Intended output][2] [2]: https://i.stack.imgur.com/nbTtR.jpg
My code so far is:
import openpyxl
fwb=openpyxl.load_workbook('wb.xlsx')
sheet=fwb['Sheet1']
sheet['A9']
for i in range(9,sheet.max_row,1):
items=sheet.cell(row=i, column=1).value
number1=sheet.cell(row=i, column=3).value
number2=sheet.cell(row=i, column=4).value
print(items, number1, number2)
My issue is I want the list of items to be under one column, just like the intended output. Hence I would ideally want items=sheet.chell(row=i, column=1 AND 2).