improve utils
							parent
							
								
									a7569f3e6f
								
							
						
					
					
						commit
						6e1a489ba4
					
				| 
						 | 
					@ -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']
 | 
					            word = sym[l][sign] + sym[l]['sep'] + base + sym[l]['sep'] + currency[l]['name'] + sym[l]['sep'] + currency[l]['end']
 | 
				
			||||||
    return word.strip()
 | 
					    return word.strip()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def read_excel(fpath=None,show_datetime=False):
 | 
					def read_excel(fpath=None,sheet_name="Sheet1",show_datetime=False):
 | 
				
			||||||
    data={}
 | 
					    data={}
 | 
				
			||||||
    if fpath:
 | 
					    if fpath:
 | 
				
			||||||
        suffix=fpath.split(".")[-1]
 | 
					        suffix=fpath.split(".")[-1]
 | 
				
			||||||
        if suffix not in ('xls', 'xlsx'):
 | 
					        if suffix not in ('xls', 'xlsx'):
 | 
				
			||||||
            raise Exception("ERROR : please should file xls or xlsx")
 | 
					            raise Exception("ERROR : please should file xls or xlsx")
 | 
				
			||||||
        wb=xlrd.open_workbook(fpath)
 | 
					        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)]
 | 
					        keys = [sheet.cell(0, col_index).value for col_index in range(sheet.ncols)]
 | 
				
			||||||
        data=[]
 | 
					        data=[]
 | 
				
			||||||
        for row_index in range(1, sheet.nrows):
 | 
					        for row_index in range(1, sheet.nrows):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue