from openpyxl import load_workbook import openpyxl as pyxl def rowWise(dF,sN,nCl,nRw): wb = load_workbook(filename = dF,data_only=True) ws=wb[sN] master=[] for r in range(2,nCl+1): for c in range(2,nRw+1): wdta=[] wdta.append(ws['A'+str(r)].value) wdta.append(ws.cell(column=c, row=1).value) wdta.append(ws.cell(column=c, row=r).value) master.append(wdta) ws = wb.create_sheet(title="RowData") i=1 for rec in master: for j in range(1,4): ws.cell(column=j,row=i).value=rec[j-1] i+=1 wb.save(filename = 'rwDta.xlsx') return 'rwDta.xlsx'