Spaces:
Sleeping
Sleeping
File size: 1,977 Bytes
b4a2e7f | 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 50 51 52 53 54 55 56 |
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}")
|