def Write_Report(y, columnFormat, SSheader, sheet): results = [] count = 0 for child in y.report: for childs in child: if childs.text is not "": asdf = Format_Check(columnFormat, SSheader, childs, count) else: asdf = childs.text results.append(asdf) count = count + 1 count = 0 sheet.append(results) results = [] # def Detail_Write_Report(y, sheet): # results = [] # # for child in y.report: # for childs in child: # if '$' in childs.text: # convert = childs.text # apply = convert[1:] # results.append(float(apply.replace(',', ''))) # else: # results.append(childs.text) # sheet.append(results) # results = [] def Format_Check(columnFormat, SSheader, childs, count): check = columnFormat[SSheader[count]] results = [] if check == "None": return childs.text elif check == "Currency": if '$' in childs.text: convert = childs.text apply = convert[1:] results.append(float(apply.replace(',', ''))) return results[0] else: return float(childs.text) elif check == "Integer": return int(childs.text) else: return childs.text