File not in directory Error

Hello ST community,
File Uploader does not work if the Excel file is not in directory, It says FileNotFound error. This should not occur, correct? I even passed in the variable existingWBUploaded into the code line →
#Opens the existing Workbook
existing_wb = load_workbook(existingWB) #TODO: changed from existingWB

#creates a new sheet inside the existing workbook

Please advice

Hi @efe_fv -

The important thing to understand about st.file_uploader is that it transfers the data through the browser into the Python and stores it in a BytesIO buffer. This is a different workflow that referencing a file directly on your computer.

Streamlit is built this way as you cannot guarantee that the place where the app is running is 1) the same computer where the app was developed and 2) that the computer where the app is running has the same file structure as the computer where the app was developed.

Once you have uploaded the file through file_uploader, you can process it as shown in the Examples section of the docs:


1 Like