✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

Upload a file and use it as global variable


I’m relatively new to Dash, I’ve covered tutorials available online, and I’m trying to create a simple ML app in dash that would allow user to process a file that he uploads and display the results. For calculations, it would be great to make uploaded file available globally as pandas df, so I can call it in functions etc… Does anyone knows how to perform this?

You can use dcc.upload for that. Are you making a multi-page app?


Sorry for replying this late. Currently I’m trying to do it all in one page, maybe I’ll split it in future, so on one page to be upload and then to redirect to page where results will be displayed. Maybe I’m missing something with dcc.upload, but all I’ve seen from documentation is that it’s using callbacks to display data and manipulate html components, but my idea is to upload it as global variable and do calculations outside and pass newly created tables into callbacks and display and graph them?