def read_excel(filepath):
"""Get excel source
Args:
filepath: The full path of excel file. excel???????
Returns:
data: Data of excel. excel???
"""
is_valid = False
try:
if os.path.isfile(filepath):
filename = os.path.basename(filepath)
if filename.split('.')[1] == 'xls':
is_valid = True
data = None
if is_valid:
data = xlrd.open_workbook(filepath)
except Exception as xls_error:
raise TypeError("Can't get data from excel!") from xls_error
return data
评论列表
文章目录