Importing multiple excels at one

Hi there,

I have a question regarding processing multiple uploaded Excel files.

Right now, I have made three separate FileFields where I can select the excels I’d like. I do not want to process them right away using @ParamsFromFile, but I would like to load them into a class containing dataframes later on, something like this in the controller:

def import_data_set(excel_1=None,
    '''This function imports three Excel workbooks
	returns a DataSet (internal class)'''
    data = DataSet()
    if excel_1 is not None:
        data.df_1 = pd.read_excel(excel_1)
    if excel_2 is not None:
        data.df_2 = pd.read_excel(excel_2)
    if excel_3 is not None:
        data.df_3 = pd.read_excel(excel_3)
    return data

However, I am stuck on how to read the files into dataframes. The below code does not work.


Does it have something to do with that the source type of the file is a URL type? Your help is much appreciated.

Thank you in advance,

Hi Yida,

That’s probably correct, I think you will need the file content (bytes) instead:

1 Like