def load_workbook(wb): global sheet_dict, company_type sheet = wb.sheet_by_index(SHEET_NUMBER) nrows = sheet.nrows for i in range(STARTING_ROW, nrows): if (not is_bold(sheet.cell(i, 1)) and (not common.is_blank(sheet.cell(i, 1)))) and (not common.is_blank(sheet.cell(i,0))): for k in fields_dictionary.keys(): sheet_dict[fields_dictionary[k]].append(sheet.cell(i, int(k) - 1).value) sheet_dict['final_assessment'].append(final_mark([sheet.cell(i,30).value, sheet.cell(i,31).value, sheet.cell(i,32).value])) sheet_dict['company_type'].append(company_type) elif is_bold(sheet.cell(i, 1)) or ("господарські" in sheet.cell(i,1).value and "товариства" in sheet.cell(i,1).value): company_type = common.refine_company_type(sheet.cell(i, 1).value)
def load_workbook(wb): global sheet_dict, company_type sheet = wb.sheet_by_index(SHEET_NUMBER) nrows = sheet.nrows for i in range(STARTING_ROW, nrows): if (not (common.is_blank(sheet.cell(i, 0)))) and (not is_company_type( sheet.cell(i, 0))): for k in fields_dictionary.keys(): sheet_dict[fields_dictionary[k]].append( sheet.cell(i, int(k) - 1).value) sheet_dict['company_type'].append(company_type) elif is_company_type(sheet.cell(i, 0)): company_type = common.refine_company_type(sheet.cell(i, 1).value)
def load_workbook(wb): global sheet_dict, company_type sheet = wb.sheet_by_index(SHEET_NUMBER) nrows = sheet.nrows for i in range(STARTING_ROW, nrows): if company_type != "" and (not is_bold(sheet.cell(i, 1)) and (not common.is_blank(sheet.cell(i, 1)))): for k in fields_dictionary.keys(): sheet_dict[fields_dictionary[k]].append( sheet.cell(i, int(k) - 1).value) sheet_dict['company_type'].append(company_type) elif is_bold(sheet.cell( i, 1)) or (isinstance(sheet.cell(i, 1).value, str) and ("державні" in sheet.cell(i, 1).value or "господарські" in sheet.cell(i, 1).value)): company_type = common.refine_company_type(sheet.cell(i, 1).value)
def load_workbook(wb): global sheet_dict, company_type sheet = wb.sheet_by_index(SHEET_NUMBER) nrows = sheet.nrows #print(is_bold(sheet.cell(14, 1)), sheet.cell(14, 1).value) for i in range(STARTING_ROW, nrows): if company_type != "" and (not common.is_blank(sheet.cell( i, 0))) and (not is_bold(sheet.cell(i, 1)) and (not common.is_blank(sheet.cell(i, 1)))): for k in fields_dictionary.keys(): sheet_dict[fields_dictionary[k]].append( sheet.cell(i, int(k) - 1).value) sheet_dict['company_type'].append(company_type) elif is_bold(sheet.cell( i, 1)) or ("господарські" in sheet.cell(i, 1).value and "товариства" in sheet.cell(i, 1).value) or ( "державн" in sheet.cell(i, 1).value and "підприємств" in sheet.cell(i, 1).value): company_type = common.refine_company_type(sheet.cell(i, 1).value)
def load_workbook(wb): global sheet_dict, date_, company_type date_ = "" sheet = wb.sheet_by_index(SHEET_NUMBER) nrows = sheet.nrows for i in range(STARTING_ROW): if date_ == "": for j in range(sheet.ncols): if isinstance(sheet.cell(i, j).value, str): date_re_matched = DATE_RE.search(sheet.cell(i, j).value) if date_re_matched: date_ = date_re_matched.group() for i in range(STARTING_ROW, nrows): if not (("господарські" in sheet.cell(i,1).value and "товариства" in sheet.cell(i,1).value) or ("державн" in sheet.cell(i,1).value and "підприємств" in sheet.cell(i,1).value)): for k in fields_dictionary.keys(): sheet_dict[fields_dictionary[k]].append(strip_if_str(sheet.cell(i, int(k) - 1).value)) non_working_status_type, non_working_status_decision = status_extract([sheet.cell(i, 10).value, sheet.cell(i, 11).value, sheet.cell(i, 12).value]) sheet_dict["non_working_status_type"].append(non_working_status_type) sheet_dict["non_working_status_decision"].append(non_working_status_decision) sheet_dict['company_type'].append(company_type) else: company_type = common.refine_company_type(sheet.cell(i, 1).value)