Reputation: 191
Is there an option to browse and import a file into Jupyter lab / notebook using windows file explorer?
I've made a file that analyze csv files. I want to let the users to pick the file they want without dealing with writing the path on their own, but rather using the regular browse method as in the figure:
Is this kind of things is possible?
Upvotes: 0
Views: 3130
Reputation: 3975
The ipyfilechooser module does exactly what you want:
from IPython.display import display
from ipyfilechooser import FileChooser
# Create and display a FileChooser widget
fc = FileChooser('/default/path')
# Set a file filter patern
fc.filter_pattern = '*.csv'
display(fc)
# Print the selected filename
print(fc.selected_filename)
Upvotes: 3