From 15b0afae1f9e28e682c15ddae0019457cc2159c1 Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Wed, 6 Mar 2024 17:29:25 +0100 Subject: [PATCH] WIP: Filling XLSX --- .../table_json_conversion/fill_xlsx.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/caosadvancedtools/table_json_conversion/fill_xlsx.py b/src/caosadvancedtools/table_json_conversion/fill_xlsx.py index 5e53fd14..5ef95925 100644 --- a/src/caosadvancedtools/table_json_conversion/fill_xlsx.py +++ b/src/caosadvancedtools/table_json_conversion/fill_xlsx.py @@ -153,18 +153,23 @@ data: dict The data at the current path position. Must be single items (dict or simple scalar) or lists of simple values. """ - sheet = self._sheet_index[".".join(current_path)].sheet + sheet_meta = self._sheet_index[".".join(current_path)] + sheet = sheet_meta.sheet next_row = _next_row_index(sheet) for name, content in data.items(): if isinstance(content, list): # TODO handle later # scalar elements: semicolon separated # nested dicts: recurse - continue - if isinstance(content, dict): pass - # from IPython import embed - # embed() + elif isinstance(content, dict): + pass + # scalars + else: + path = current_path + [name] + path_str = ".".join([ColumnType.SCALAR.name] + path) + col_index = sheet_meta.col_index[path_str].col_index + sheet.cell(row=next_row+1, column=col_index+1, value=content) def fill_template(data: Union[dict, str, TextIO], template: str, result: str) -> None: -- GitLab