Guest User

Untitled

a guest
Jan 21st, 2020
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. teams_by_name = {
  2. 'Eastern Unit': eastern_unit
  3. 'Eastern Local Team': eastern_local_teams
  4. 'Mid West Unit': mid_west_unit
  5. 'Mid West Local Team': mid_west_local_teams
  6. 'North East Unit': north_east_unit
  7. 'North East Local Team': north_east_local_teams
  8. 'North West Unit': north_west_unit
  9. 'North West Local Team': north_west_local_teams
  10. 'South East Unit': south_east_unit
  11. 'South East Local Team': south_east_local_unit
  12. 'South West Unit': south_west_unit
  13. 'South West Local Team': south_west_local_teams
  14. 'West Central Mid Unit': west_central_midlands_unit
  15. 'West Central Mid Local Team': west_central_midlands_local_teams
  16. }
  17.  
  18. units_and_local_workbook = load_workbook(filename='teams.xlsx')
  19. for sheets in units_and_local_workbook:
  20. unit_sheet = units_and_local_workbook.get_sheet_by_name(sheets.title)
  21. for value in unit_sheet.iter_rows(min_row=3, min_col=1, max_col=1, values_only=True):
  22. string_out = str(value)
  23. unit_number = re.findall(r'\d+', string_out)
  24. if unit_sheet.title in teams_by_name:
  25. teams_by_name[unit_sheet.title].append(int(unit_number[0]))
  26. else:
  27. raise Exception("Unexpected team name: " + unit_sheet.title)
RAW Paste Data