File_uploader

What is it I don’t see? The following works as expected:

uploadFile = 'POCPWA_AppExport_15-3-2022.xlsx'
if uploadFile:
	.... whatever ...

But this does not, “None” is printed.

uploadFile = st.file_uploader("Upload your excel file",type=["xlsx"]); print(uploadFile)
if uploadFile:
       .........

Hi @Rense_Lange -

It’s important to recognize that Streamlit evaluates the code top-to-bottom on each interaction. The top code says “If uploadFile exists, then do something”. The second one, st.file_uploader is placed on the page, but until someone interacts with it, the value of uploadFile is None. Only after something is uploaded, does it get a value.

Best,
Randy

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.