How to take Text Input from a user

Hi Team ,

The package looks great!. I wanted to know if there is a simple way to take a text input from the user and use the input to filter or create views on streamlit. Since there are many millions of data points , i am unable to use the slider or dropdown option for this

Thanks and regards,

1 Like

Hi Aravind_K_R

There are two ways to get text input from users.

First, there’s st.text_input for when you only need a single line of text:

user_input = st.text_input("label goes here", default_value_goes_here)

Then there’s st.text_area for then you want multiple lines of text:

user_input = st.text_area("label goes here", default_value_goes_here)

In both cases, the default_value_goes_here argument is optional. You can find more about these in our API documentation.

Let me know if this answers your question!


Thank you for the prompt response. Will check it out :slight_smile:

1 Like

Hi all,
Has anyone successfully tried to use this input function to get the location of a file and use it to load data?
I’m a entering the location of the file in my system and using pandas to read the csv but I haven’t been able to see the data.
Thanks in advance

Hi @gabe_maldonado

That’s definitely possible!

Here’s an example that I just tested on my machine:

import streamlit as st
import pandas as pd

path = st.text_input('CSV file path')
if path:
    df = pd.read_csv(path)

Then try a file like this one:


Obrigado @thiago! Works like a charm. I appreciate the help.


Update – This works perfect on the localhost. I am able to retrieve any dataframe from my machine and perform EDA. I deployed this to heroku but I am not able to access the files. I encounter a:
FileNotFoundError:[[Errno2] File 'bFileName does not exist

Hi, I have been using Streamlit for a while. The text input package looks great. There is an issue I am running into. I have been using a text input in my app to ask the user for word input. The word they write is to get added to an already existing list. Now, once the word is added, and the user wants to input a new word, the previous word is getting removed from the list. Is there a way to make the text inputs from users permanent? Thanks in advance.