diff --git a/config_generator.py b/config_generator.py index 5e9cebb..24b24e7 100644 --- a/config_generator.py +++ b/config_generator.py @@ -165,15 +165,15 @@ class ConfigGenerator: def gen_config_json(self): sheet = self.sheet_helper.get_sheet_table(self.google_sheet_file_name, self.sheet_table_name) sheet_all_row_datas = sheet.get_all_values(major_dimension='ROWS') - config_json = {'datas': []} + config_json = {} error_lines = [] - data_row_index = -1 + list_field = '' for i, row_values in enumerate(sheet_all_row_datas): - if data_row_index == -1: - if 'data' not in str(row_values[0]).lower(): - continue - else: - data_row_index = i + if i <= 4: + continue + if row_values[0] != '': + list_field = row_values[0] + config_json[list_field] = [] if self.is_row_env_valid(row_values) is False: continue @@ -184,7 +184,7 @@ class ConfigGenerator: elif len(item_data) == 0: continue else: - config_json['datas'].append(item_data) + config_json[list_field].append(item_data) if len(error_lines) > 0: config.notification.append_msg(str(error_lines))