How to change the csv delimiter of st.dataframe's native downloader?

My topic is very simple. I just want to be able to set the delimiter of st.dataframe’s csv downloader.

import pandas as pd
import streamlit as st

df = pd.DataFrame(
    {
        "Column 1": range(1, 6),
        "Column 2": range(6, 11),
        "Column 3": range(11, 16),
    },
)

st.dataframe(df, hide_index=True)

After clicking on “Download as Csv”, I can save a csv file 2024-09-01T11-45_export.csv, that looks like :

Column 1,Column 2,Column 3
1,6,11
2,7,12
3,8,13
4,9,14
5,10,15

The problem here is that Streamlit assumes that we always want a comma (,) as separator.

Is there a way to change that ?

1 Like