From 6e1a489ba4497af0980f6fdffda70d2bcd8c4818 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 13 Jan 2016 11:57:24 +0700 Subject: [PATCH] improve utils --- netforce_clinic/models/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netforce_clinic/models/utils.py b/netforce_clinic/models/utils.py index b6eab78..e5d13f9 100644 --- a/netforce_clinic/models/utils.py +++ b/netforce_clinic/models/utils.py @@ -161,14 +161,14 @@ def num2word(n,l="th_TH"): word = sym[l][sign] + sym[l]['sep'] + base + sym[l]['sep'] + currency[l]['name'] + sym[l]['sep'] + currency[l]['end'] return word.strip() -def read_excel(fpath=None,show_datetime=False): +def read_excel(fpath=None,sheet_name="Sheet1",show_datetime=False): data={} if fpath: suffix=fpath.split(".")[-1] if suffix not in ('xls', 'xlsx'): raise Exception("ERROR : please should file xls or xlsx") wb=xlrd.open_workbook(fpath) - sheet=wb.sheet_by_name("Sheet1") + sheet=wb.sheet_by_name(sheet_name) keys = [sheet.cell(0, col_index).value for col_index in range(sheet.ncols)] data=[] for row_index in range(1, sheet.nrows):