mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-10 02:07:12 +08:00
fix: improve error message when uploading Excel file with incorrect column count
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user