How to save exvel file to user desktop

Dear friend, I am attempting to save a pandas DataFrame as a CSV file on the user’s desktop. Could you please provide me with the correct code to accomplish this task, whether it be saving the file to the desktop, the documents folder, or the downloads folder? Thank you in advance for your assistance.
df.to_excel(“c:\Downloads\test.csvx”)

Hi @badar, you will want to use st.download_button - Streamlit Docs – you can see an example with a CSV in the examples section of the docs page.