@@ -35,14 +35,44 @@ def map_data_row_into_test_data_obj(self, ws_column_indexes, ws_title, row_index
35
35
def get_all_worksheet (self , wb ):
36
36
return list (wb )
37
37
38
+ def parsing_major_column_indexs (self , ws ):
39
+ ws_column_indexs = {}
40
+ key_index_row = 0
41
+ found_default_column_indexs = False
42
+
43
+ # Parse mandatory property
44
+ for index , row in enumerate (ws .rows ):
45
+ if index > self .maximum_column_index_row :
46
+ break
47
+ for cell in row :
48
+ if (cell .value is not None ) and (cell .value in self .DEFAULT_COLUMN_INDEXS ):
49
+ ws_column_indexs [cell .value ] = column_index_from_string (coordinate_from_string (cell .coordinate )[0 ])
50
+ print (str (datetime .now ()) + ': Mandatory : ' + str (cell .value ) + ' : ' + str (
51
+ cell .coordinate ) + ' : ' + str (
52
+ column_index_from_string (coordinate_from_string (cell .coordinate )[0 ])))
53
+ key_index_row = index + 1
54
+ found_default_column_indexs = True
55
+
56
+ if (cell .value is not None ) and (cell .value not in self .DEFAULT_COLUMN_INDEXS ) and (found_default_column_indexs is False ):
57
+ field_name = str (cell .value ).lower ().strip ().replace (" " , "_" )
58
+ if field_name == self .main_column_key :
59
+ key_index_row = index + 1
60
+
61
+ if len (ws_column_indexs ) > 0 :
62
+ break
63
+
64
+ return ws_column_indexs , key_index_row
65
+
38
66
def parsing_column_indexs (self , ws ):
39
67
ws_column_indexs = {}
68
+
40
69
# Parse mandatory property
41
70
for index , row in enumerate (ws .rows ):
42
71
if index > self .maximum_column_index_row :
43
72
break
44
73
for cell in row :
45
74
if (cell .value is not None ) and (cell .value in self .DEFAULT_COLUMN_INDEXS ):
75
+ found_mandatory_property = True
46
76
ws_column_indexs [cell .value ] = column_index_from_string (coordinate_from_string (cell .coordinate )[0 ])
47
77
print (str (datetime .now ())+ ': Mandatory : ' + str (cell .value ) + ' : ' + str (cell .coordinate ) + ' : ' + str (column_index_from_string (coordinate_from_string (cell .coordinate )[0 ])))
48
78
self .start_row = index + 1
0 commit comments