Spaces:
Sleeping
Sleeping
Download src/streamlit_app.py from AhmedUddin2002/practice: direct link, hf CLI and curl.
- Browser
- Download file 711 Bytes
-
https://huggingface.co/spaces/AhmedUddin2002/practice/resolve/main/src/streamlit_app.py
- Command line
-
hf download hf://spaces/AhmedUddin2002/practice/src/streamlit_app.py
-
curl -L -o streamlit_app.py https://huggingface.co/spaces/AhmedUddin2002/practice/resolve/main/src/streamlit_app.py
711 Bytes
| # app.py | |
| import streamlit as st | |
| import pandas as pd | |
| st.title("Excel to CSV Converter") | |
| # File uploader | |
| uploaded_file = st.file_uploader("Upload an Excel file", type=["xlsx"]) | |
| if uploaded_file: | |
| try: | |
| # Read Excel file | |
| df = pd.read_excel(uploaded_file) | |
| # Show preview | |
| st.write("### Preview of Uploaded Excel File", df.head()) | |
| # Convert to CSV | |
| csv = df.to_csv(index=False).encode('utf-8') | |
| # Download button | |
| st.download_button( | |
| label="Download CSV", | |
| data=csv, | |
| file_name="converted_file.csv", | |
| mime="text/csv" | |
| ) | |
| except Exception as e: | |
| st.error(f"❌ Error reading file: {e}") | |