I have an excel workbook with 49 sheets (all same columns, different data). I want to load this data into a database, by creating one csv file from the 49 sheets. My plan is to read and concatenate each sheet into a "master" dataframe. Then I will write this dataframe a csv file, which I can load into a database (probably mySQL).
I have successfully read the first 3 sheets, one at a time, as follows:
xls = pd.ExcelFile('Pages 1-49.xlsx')
xls.sheet_names
pdf_1 = pd.read_excel(xls, sheet_name='page 1',skiprows=1)
pdf.append(pdf_next)
I execute this code 2 more times (not shown here) and have 3 dataframes named pdf_1, pdf_2, and pdf 3.
I then concatenate these three dataframes as follows:
voters = pd.concat([pdf_1, pdf_2, pdf_3],ignore_index='false')
Everything is "working" - I have a single dataframe - but I have a total of 150 worksheets. How do I go from one-at-a-time to a loop?
I want one dataframe containing 150 worksheets of data.
Probably a simple task but I've spent several long days to get this far. I'd really appreciate some help.