How can i select a folder and read each txt file with a button?

Hello,
I would like to know if it’s possible to select a folder(in this case with txt files), then read the first txt file, then with a button read the next/previous txt file.
The goal of this project is to visualize the changes between versions.
Thank you very much.

import streamlit as st
st.title('Read TXT')
uploaded_file = st.file_uploader(label="Choose a TXT file", type=['.txt'])

if uploaded_file is not None:
  # To read file as bytes:
     bytes_data = uploaded_file.getvalue()
     st.write(bytes_data)

col1, col2 = st.columns([0.5,1.5])

with col1:
    st.button('Previous TXT')
with col2:
    st.button('Next TXT')
````Preformatted text`

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.