diff --git a/param-files/excel_to_yaml.py b/param-files/excel_to_yaml.py new file mode 100644 index 0000000..525a6ea --- /dev/null +++ b/param-files/excel_to_yaml.py @@ -0,0 +1,18 @@ +import os +import re +import yaml +import pandas as pd +from glob import glob + +excel_names = glob('*.xlsx') + +for excel_name in excel_names: + print('processing {}'.format(excel_name)) + df = pd.read_excel(excel_name) + survey_id, _ = os.path.splitext(excel_name) + + for i, row in df.iterrows(): + beach = row['BEACH'].replace('_', '-').lower() + yaml_name = '{}-{}.yaml'.format(survey_id, beach) + with open(yaml_name, 'w') as f: + f.write(yaml.dump(row.to_dict(), default_flow_style=False)) diff --git a/param-files/survey-1.xlsx b/param-files/survey-1.xlsx new file mode 100644 index 0000000..486e322 Binary files /dev/null and b/param-files/survey-1.xlsx differ