Skip to content
Advertisement

Problem with different extension files upload at streamlit

I’m trying to let the user select what files he wants to upload, but I’m facing a problem.

For example, there are two types of extension files the user can upload (csv and xlsx). After he upload his file streamlit needs to open the file and shows as a dataframe. But in code I did, I create two if’s to read the files with xlsx extension and csv extension, but didn’t worked as expected…

Upload file Button:

enter image description here

Here is my code:

JavaScript

Advertisement

Answer

Your if-else statement needs to be modified to:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement