I've read in the below excel workbook which has 40 sheets. The below reads in all the worksheets:
df = pd.read_excel(file_path, sheet_name = None)
All the worksheets have identical columns, but the relevant columns start at different rows in each worksheet, so I'm writing the below to create a df from each sheet:
df2 = df[Sheet_Name]
df2.columns = df2.iloc[20]
I could replicate this code 40 times with the relevant row index, but there has to be a function with a loop that can clean the code.
I was thinking of having 2 lists, sheet name & row index, which the function iterates over to create a separate df for each worksheet.
Is this possible?
Thanks for your help