def combine_sheets(nm_list,z_dt): l_fn = 'UAB_' + z_dt.strftime('%m%d%y') + '.xls' l_f = os.path.join(l_p,l_fn) if os.path.isfile(l_f): os.remove(l_f) lf_o = Xls(l_f) for fn in nm_list: f = os.path.join(arc_p,fn) sf = Xls(f) sht = sf.xls.Worksheets(1) sht.Move(lf_o.wkbk.Worksheets(1)) sht_name = os.path.splitext(fn)[0] lf_o.wkbk.ActiveSheet.Name = sht_name os.remove(f) f2 = os.path.join(l_p,'_Report Descriptions.xls') sf2 = Xls(f2) sht2 = sf2.xls.Worksheets(1) sht2.Move(lf_o.wkbk.Worksheets(1)) lf_o.saveclosequit(close=False) return lf_o
def log_claim_file_counts(loadfilecount,claimcount,xz_fn,xz_dt): rec_log_fn = '837 RIC Receipt Log.xls' rec_log = os.path.join(reclogpath,rec_log_fn) rec_log_o = Xls(rec_log) wksht = 'Sent ' + xz_dt.strftime('%Y-%m') try: rec_log_o.xls.ActiveWorkbook.Worksheets(wksht).Activate() except: # create new worksheet rec_log_o.xls.Worksheets.Add() rec_log_o.xls.ActiveSheet.Name = wksht headers = ['Date','File Count','Claim Count','File Name'] rec_log_o.load_headers(headers) blank_row = rec_log_o.find_first_blank_row() loadvals = [xz_dt.strftime('%m/%d/%Y'),loadfilecount,claimcount,xz_fn] for i,lv in enumerate(loadvals): rec_log_o.loadvalue(lv,blank_row,i+1) rec_log_o.saveclosequit() return None