Skip to content

Commit

Permalink
sheet_get_named_column(): Rewritten slightly to be simpler.
Browse files Browse the repository at this point in the history
  • Loading branch information
bettingr committed Dec 5, 2023
1 parent 0980cae commit fbeaff4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions billing_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ def sheet_get_named_column(sheet, col_name):
for idx in range(len(header_row)):
# if header_row[idx] == col_name:
if header_row[idx].value == col_name:
col_name_idx = idx
col_name_idx = idx+1
break
else:
return None

max_row = sheet.max_row

# return sheet.col_values(col_name_idx,start_rowx=1)
return list(list(sheet.iter_cols(min_col=col_name_idx+1,max_col=col_name_idx+1,min_row=2,values_only=True))[0])
# return list(list(sheet.iter_cols(min_col=col_name_idx+1,max_col=col_name_idx+1,min_row=2,values_only=True))[0])
return list(map(lambda v: v.value, sheet[openpyxl.utils.cell.get_column_letter(col_name_idx)] ))[1:]


# This function returns the dict of values in a BillingConfig's Config sheet.
def config_sheet_get_dict(wkbk):
Expand Down

0 comments on commit fbeaff4

Please sign in to comment.