DataFrame from the passed in Excel file. See notes in sheet_name argument for more information on when a Dict of Dataframes is returned.
Aha, so sometimes we get a dictionary instead of a DataFrame, let’s look at sheet_name to see why:
sheet_name : string, int, mixed list of strings/ints, or None, default 0
Strings are used for sheet names, Integers are used in zero-indexed sheet positions.
Lists of strings/integers are used to request multiple sheets.
Specify None to get all sheets.
str|int -> DataFrame is returned. list|None -> Dict of DataFrames is returned, with keys representing sheets.
Available Cases
Defaults to 0 -> 1st sheet as a DataFrame
1 -> 2nd sheet as a DataFrame
“Sheet1” -> 1st sheet as a DataFrame
[0,1,”Sheet5”] -> 1st, 2nd & 5th sheet as a dictionary of DataFrames
None -> All sheets as a dictionary of DataFrames
So it seems like your variable “tab” is either a list or None. Either are possible from the code, you’ve not given us the layout so we can’t tell. Print out the variable “tab” and you should be able take it from there!
Ok. Thats the problem. While loading the app, tab is None. So, I’m going to validate the tab before read_excel. I didn’t realize this. Thanks for pointing out.