@@ -54,7 +54,7 @@ def parsing_major_column_indexs(self, ws):
54
54
found_default_column_indexs = True
55
55
56
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 ( " " , "_" )
57
+ field_name = self . _cleanup_fieldname (cell .value )
58
58
if field_name == self .main_column_key :
59
59
key_index_row = index + 1
60
60
@@ -87,7 +87,7 @@ def parsing_column_indexs(self, ws):
87
87
continue
88
88
for cell in row :
89
89
if (cell .value is not None ) and (cell .value not in self .DEFAULT_COLUMN_INDEXS ):
90
- field_name = str (cell .value ). lower (). strip (). replace ( " " , "_" )
90
+ field_name = self . _cleanup_fieldname (cell .value )
91
91
ws_column_indexs [field_name ] = column_index_from_string (coordinate_from_string (cell .coordinate )[0 ])
92
92
print (str (datetime .now ())+ ': Optional : ' + field_name + ' : ' + str (cell .coordinate ) + ' : ' + str (column_index_from_string (coordinate_from_string (cell .coordinate )[0 ])))
93
93
break
@@ -107,3 +107,9 @@ def parse_test_data_properties(self, ws, ws_column_indexs):
107
107
print (str (datetime .now ())+ ': Total test datas: ' + str (len (test_datas )))
108
108
return test_datas
109
109
110
+ def _cleanup_fieldname (self , field_name ):
111
+ field_name = str (field_name ).lower ().strip ().replace (" " , "_" )
112
+ field_name = field_name .replace ("\r " , "_" )
113
+ field_name = field_name .replace ("\n " , "_" )
114
+ field_name = field_name .replace ("__" , "_" )
115
+ return field_name
0 commit comments