test2 / app.py
rayuga2503's picture
Upload 2 files
ea883ea verified
import streamlit as st
import pandas as pd
# ---------------------------
# App Title and Description
# ---------------------------
st.set_page_config(page_title="Excel Data Dashboard", layout="wide")
st.title("πŸ“Š Excel Data Upload & Preview Dashboard")
st.markdown("""
Upload your Excel file below to view and explore data.
This app works best when deployed on **Streamlit Cloud** or run locally.
""")
# ---------------------------
# File Uploader
# ---------------------------
uploaded_file = st.file_uploader("πŸ“‚ Upload Excel File", type=["xlsx", "xls"])
if uploaded_file is not None:
try:
# Read Excel file
df = pd.read_excel(uploaded_file)
# Success message
st.success(f"βœ… File '{uploaded_file.name}' uploaded successfully!")
# Show basic info
st.write("### Data Preview")
st.dataframe(df.head())
# Basic statistics
st.write("### Data Summary")
st.write(df.describe(include='all'))
# Optional: download processed CSV
csv = df.to_csv(index=False).encode('utf-8')
st.download_button(
label="⬇️ Download Data as CSV",
data=csv,
file_name="processed_data.csv",
mime="text/csv"
)
except Exception as e:
st.error(f"❌ Error reading file: {e}")
else:
st.info("Please upload an Excel file to start.")