logging.debug("Starting the script") print("starting") for ifile in ifiles: logging.info("Processing file:" + ifile) #print "The number of worksheet is: %d" % book.nsheets try: book = xlrd.open_workbook(ifile) sheet = book.sheet_by_name("Findings & CAP") facility_profile = book.sheet_by_name("Facility Profile") except xlrd.XLRDError as e: logging.exception("Unable to open -Findings & CAP- in file: " + ifile ) continue ar = AuditReportWriter(ifile+'.xls','Findings & CAP') for rx in range(2,sheet.nrows): try: finding = unicode(sheet.cell_value(rowx=rx,colx=6)) #Column E, row = rx #print "%04x" % ord(finding[0]) if finding.lower() == "n/a" or finding.strip() == '': continue findingdetail1 = unicode(sheet.cell_value(rowx=rx,colx=7)) #Column F, row=rx findingdetail2 = unicode(sheet.cell_value(rowx=rx,colx=8)) #Column G, row=rx findingdetail3 = unicode(sheet.cell_value(rowx=rx,colx=9)) id = unicode(sheet.cell_value(rowx=rx,colx=1)) #Column B, row=rx cat = unicode(sheet.cell_value(rowx=rx,colx=2)), #Column C, row=rx cause = unicode(sheet.cell_value(rowx=rx,colx=8)), #Column I
#read facility profile config facility_mapper = FacilityMapper(facility_profile_file) for ifile in ifiles: logging.info("Processing file:" + ifile) #print "The number of worksheet is: %d" % book.nsheets try: book = xlrd.open_workbook(ifile) sheet = book.sheet_by_name("Findings & CAP") facility_profile = book.sheet_by_name("Facility Profile") except xlrd.XLRDError as e: logging.exception("Unable to open -Findings & CAP- in file: " + ifile ) continue ar = AuditReportWriter(ifile+'.xls','Findings & CAP') for rx in range(2,sheet.nrows): try: finding = sheet.cell_value(rowx=rx,colx=4) #Column E, row = rx #print finding; if finding.lower() == "n/a" or finding.strip() == '': continue findingdetail1 = sheet.cell_value(rowx=rx,colx=5) #Column F, row=rx findingdetail2 = sheet.cell_value(rowx=rx,colx=6) #Column G, row=rx id = sheet.cell_value(rowx=rx,colx=1) #Column B, row=rx cat = sheet.cell_value(rowx=rx,colx=2), #Column C, row=rx cause = sheet.cell_value(rowx=rx,colx=8), #Column I