|
@@ -510,11 +510,15 @@ def other_type_string_type_parent_id_create_data(db,string,type_parent_id,file_i
|
|
|
return reslte ,False
|
|
|
return reslte ,True
|
|
|
def import_data(db,file_path,user_id,file_info):
|
|
|
- book = xlrd.open_workbook(file_path)
|
|
|
- sheet = book.sheet_by_index(0)
|
|
|
|
|
|
- data = []
|
|
|
import_status = True
|
|
|
+ try:
|
|
|
+ book = xlrd.open_workbook(file_path)
|
|
|
+ sheet = book.sheet_by_index(0)
|
|
|
+ except :
|
|
|
+ file_info.remark = file_info.remark + f'\n文件打开失败,请核实文件格式为xlsx/xlx>'
|
|
|
+ import_status = False
|
|
|
+ data = []
|
|
|
for row in range(4, sheet.nrows):
|
|
|
# 姓名
|
|
|
name = sheet.cell(row, 0).value
|