fix: improve error message when uploading Excel file with incorrect column count

This commit is contained in:
ulleo
2025-11-27 14:56:51 +08:00
committed by ulleo
parent d916e2911f
commit 8023ce2907
9 changed files with 62 additions and 6 deletions
+12
View File
@@ -0,0 +1,12 @@
import pandas as pd
def get_excel_column_count(file_path, sheet_name):
"""获取Excel文件的列数"""
df_temp = pd.read_excel(
file_path,
sheet_name=sheet_name,
engine='calamine',
header=0,
nrows=0
)
return len(df_temp.columns)