From fe71ae7bcebdb0563fce5717e28056b9016bb1af Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 3 Mar 2023 10:05:02 +0100 Subject: [PATCH] [FIX] Manage jsonb fields --- sql_export_excel/models/sql_export.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py index 53cde9f076..68194c52ec 100644 --- a/sql_export_excel/models/sql_export.py +++ b/sql_export_excel/models/sql_export.py @@ -110,6 +110,9 @@ def excel_get_data_from_query(self, variable_dict): col_position = 1 for index, row in enumerate(res, row_position): for col, val in enumerate(row, col_position): + # manage jsonb field as dict are not writable on the excel cell + if isinstance(val, dict): + val = str(val) ws.cell(row=index, column=col).value = val output = BytesIO() wb.save(output)