def find_matching_row(sheet_data, flag, worksheet_name = ""):
    """Find row index of cell in the first column of sheet_data which
       matches 'flag'

    """
    matching_row = None

    # Loop through the rows and look for a match in the first column

    for i in range(len(sheet_data)):
        if flag in sheet_data[i][0]:
            matching_row = i
            break

    if matching_row is None:
        msg = 'Could not find a cell in the first column of worksheet *' \
            + worksheet_name + '* matching with *' + flag + '*'
        raise Exception(msg)

    return matching_row