Spaces:
Sleeping
Sleeping
| # core/buzzure.py | |
| import pandas as pd | |
| # Your public GSheet URL (Make sure it's published to the web or accessible) | |
| GOOGLE_SHEET_URL = "https://docs.google.com/spreadsheets/d/e/2PACX-1vTT8y6xLXnM2VF2aXsl0u7aVgFRxQ8M7Qb_eTJiHxd_7hjQ6g3sJtbr7pHT2rnxk4EJ_tcSqhvsrrXQ/pub?gid=834276878&single=true&output=csv" | |
| def fetch_topics_from_sheet(): | |
| try: | |
| df = pd.read_csv(GOOGLE_SHEET_URL) | |
| if "Topics" not in df.columns: | |
| print("⚠️ 'Topics' column not found in sheet.") | |
| return ["General"] | |
| topics = df["Topics"].dropna().unique().tolist() | |
| if not topics: | |
| print("⚠️ Sheet loaded, but no topics found.") | |
| return ["General"] | |
| print(f"✅ Topics loaded from sheet: {topics}") | |
| return topics | |
| except Exception as e: | |
| print(f"❌ Error loading topics from sheet: {e}") | |
| return ["General"] | |