I want to allow the user to upload multiple csv files and prompt to input start_date
for each csv file. Depending on the number of uploaded files, I would like to have the start_date
field to be in separate columns instead of being vertically stacked on one another.
Can you please help me to build this logic?
Here is my current code (which is not working)
uploaded_files = st.sidebar.file_uploader('Upload file(s) here', accept_multiple_files=True)
def uploadFile(upload_file):
if uploaded_file is not None:
df = pd.read_csv(upload_file)
df = uploadFile(upload_file)
def process_csv():
if uploaded_files:
ncol = len(uploaded_files)
cols = st.columns(ncol)
for i in range(ncol):
with cols[ncol[i]]:
for uploaded_file in uploaded_files:
with st.spinner(text= f"Loading file: {uploaded_file.name}"):
df = uploadFile(uploaded_file)
start_date = st.date_input(f'Enter start date for {uploaded_file.name}', value=None, key=uploaded_file.name)
"""further processing here"""