SheetMate / app.py
akashshahade's picture
Upload 6 files
53848b2 verified
import streamlit as st
import pandas as pd
from excel_parser import parse_excel
from query_agent import ask_question
from utils import export_to_csv, export_to_pdf
st.set_page_config(page_title="SheetMate πŸ“Š", layout="wide")
st.title("πŸ€– SheetMate β€” Chat with your Excel")
uploaded_file = st.file_uploader("πŸ“‚ Upload an Excel file", type=["xlsx", "xls"])
if uploaded_file:
dfs = parse_excel(uploaded_file)
sheet = st.selectbox("πŸ—‚οΈ Select a sheet", list(dfs.keys()))
df = dfs[sheet]
st.dataframe(df, use_container_width=True)
col1, col2 = st.columns(2)
with col1:
if st.button("⬇️ Export to CSV"):
csv = export_to_csv(df)
st.download_button("Download CSV", csv, "sheetmate_data.csv", "text/csv")
with col2:
if st.button("🧾 Export to PDF"):
pdf_bytes = export_to_pdf(df)
st.download_button("Download PDF", pdf_bytes, "sheetmate_data.pdf", "application/pdf")
user_query = st.text_input("πŸ’¬ Ask a question about your data")
if user_query:
with st.spinner("πŸ€” Thinking..."):
answer = ask_question(user_query, df)
st.success(answer)
st.markdown("---")
st.markdown("πŸ› οΈ Developed by **Akash Shahade**", unsafe_allow_html=True)