Spaces:
Sleeping
Sleeping
| import pandas as pd | |
| import os | |
| import sys | |
| # Define path exactly as in data_service.py | |
| DATA_PATH = "/run/media/ishpreet/New Volume/Auribises/Vardhman Textiles/Final Base Data for PD Gr issue Norsm 15-01-26.xlsx" | |
| print(f"Checking {DATA_PATH}...") | |
| if not os.path.exists(DATA_PATH): | |
| print("β File NOT found!") | |
| # Check fallback | |
| fallback = "/run/media/ishpreet/New Volume/Auribises/Vardhman Textiles/Data Set.xlsx" | |
| if os.path.exists(fallback): | |
| print(f"β οΈ Fallback found: {fallback}") | |
| DATA_PATH = fallback | |
| else: | |
| print("β Fallback also NOT found.") | |
| sys.exit(1) | |
| try: | |
| print("Reading Excel file (this might take a moment)...") | |
| xl = pd.ExcelFile(DATA_PATH) | |
| print(f"Sheet names: {xl.sheet_names}") | |
| if "Finish Description" in xl.sheet_names: | |
| df = pd.read_excel(xl, "Finish Description", nrows=5) | |
| print("\n--- Finish Description Columns ---") | |
| print(list(df.columns)) | |
| print(df.head(2).to_string()) | |
| if "PO Type" in xl.sheet_names: | |
| df = pd.read_excel(xl, "PO Type", nrows=5) | |
| print("\n--- PO Type Columns ---") | |
| print(list(df.columns)) | |
| print(df.head(2).to_string()) | |
| # Check Detail/Master for Shade Type | |
| if "Detail" in xl.sheet_names: | |
| df = pd.read_excel(xl, "Detail", nrows=5, header=2) # Adjust header if needed | |
| print("\n--- Detail Columns (header=2) ---") | |
| cols = list(df.columns) | |
| print(cols[:10], "...") | |
| if "Shade Type" in cols: | |
| print("β 'Shade Type' column FOUND in Detail.") | |
| else: | |
| print("β 'Shade Type' column NOT FOUND in Detail.") | |
| # Check if it's there with header=0? | |
| df0 = pd.read_excel(xl, "Detail", nrows=5, header=0) | |
| if "Shade Type" in df0.columns: | |
| print("β οΈ 'Shade Type' found with header=0.") | |
| except Exception as e: | |
| print(f"β Error reading Excel: {e}") | |