fix: fix excel upload path error

This commit is contained in:
junjun
2025-08-08 10:32:46 +08:00
parent 7a28587e66
commit a23f2839c6
+1 -1
View File
@@ -273,7 +273,7 @@ async def upload_excel(session: SessionDep, file: UploadFile = File(...)):
for sheet_name in sheet_names:
tableName = f"{sheet_name}_{hashlib.sha256(uuid.uuid4().bytes).hexdigest()[:10]}"
sheets.append({"tableName": tableName, "tableComment": ""})
df_temp = pd.read_excel(path, nrows=5)
df_temp = pd.read_excel(save_path, nrows=5)
non_empty_cols = df_temp.columns[df_temp.notna().any()].tolist()
df = pd.read_excel(save_path, sheet_name=sheet_name, engine='calamine', usecols=non_empty_cols)
insert_pg(df, tableName, engine)