According to pandas doc for 0.21+, pandas.read_excel
has a parameter sheet_name
that allows specifying which sheet is read. But when I am trying to read the second sheet from an excel file, no matter how I set the parameter (sheet_name = 1
, sheet_name = 'Sheet2'
), the dataframe always shows the first sheet, and passing a list of indices (sheet_name = [0, 1]
) does not return a dictionary of dataframes but still the first sheet. What might be the problem here?
It looks like you're using the old version of Python. So try to change your code
df = pd.read_excel(file_with_data, sheetname=sheet_with_data)
It should work properly.