Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +48 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
# ---------------------------
|
| 5 |
+
# App Title and Description
|
| 6 |
+
# ---------------------------
|
| 7 |
+
st.set_page_config(page_title="Excel Data Dashboard", layout="wide")
|
| 8 |
+
st.title("📊 Excel Data Upload & Preview Dashboard")
|
| 9 |
+
|
| 10 |
+
st.markdown("""
|
| 11 |
+
Upload your Excel file below to view and explore data.
|
| 12 |
+
This app works best when deployed on **Streamlit Cloud** or run locally.
|
| 13 |
+
""")
|
| 14 |
+
|
| 15 |
+
# ---------------------------
|
| 16 |
+
# File Uploader
|
| 17 |
+
# ---------------------------
|
| 18 |
+
uploaded_file = st.file_uploader("📂 Upload Excel File", type=["xlsx", "xls"])
|
| 19 |
+
|
| 20 |
+
if uploaded_file is not None:
|
| 21 |
+
try:
|
| 22 |
+
# Read Excel file
|
| 23 |
+
df = pd.read_excel(uploaded_file)
|
| 24 |
+
|
| 25 |
+
# Success message
|
| 26 |
+
st.success(f"✅ File '{uploaded_file.name}' uploaded successfully!")
|
| 27 |
+
|
| 28 |
+
# Show basic info
|
| 29 |
+
st.write("### Data Preview")
|
| 30 |
+
st.dataframe(df.head())
|
| 31 |
+
|
| 32 |
+
# Basic statistics
|
| 33 |
+
st.write("### Data Summary")
|
| 34 |
+
st.write(df.describe(include='all'))
|
| 35 |
+
|
| 36 |
+
# Optional: download processed CSV
|
| 37 |
+
csv = df.to_csv(index=False).encode('utf-8')
|
| 38 |
+
st.download_button(
|
| 39 |
+
label="⬇️ Download Data as CSV",
|
| 40 |
+
data=csv,
|
| 41 |
+
file_name="processed_data.csv",
|
| 42 |
+
mime="text/csv"
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
except Exception as e:
|
| 46 |
+
st.error(f"❌ Error reading file: {e}")
|
| 47 |
+
else:
|
| 48 |
+
st.info("Please upload an Excel file to start.")
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
pandas
|
| 3 |
+
openpyxl
|
| 4 |
+
xlrd
|