Spaces:
Sleeping
Sleeping
File size: 1,397 Bytes
ea883ea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
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.")
|