Loading csv-data into data source by a JavaScript Callback

I can’t help answer your question but I have an application where a user uploads an excel file, which gets put into a dataframe and various plots are generated. I did it using the FileInput widget. It was discussed in this question.

;Main code
df_data = pd.DataFrame()
df_header = pd.DataFrame()
p = Paragraph(text="""Select File:""")
file_input = FileInput(accept=".xls,.xlsx")
file_input.on_change('value', upload_fit_data)
doc=curdoc()
doc.add_root(row(p,file_input))

;processing function
def upload_fit_data(attr, old, new):
global df_header
global df_data
global row_split
decoded = b64decode(new)
cpt_file = io.BytesIO(decoded)
#cpt_file = '18-04011_GP08-BSC.xls'

xls = pd.read_excel(cpt_file)

row_split = (xls[xls.isin(['Layer'])].dropna(how='all').index + 2)[0]
df_header = xls.iloc[0:row_split, :]
df_data = xls.iloc[row_split:, :]
pd.set_option('mode.chained_assignment', None)