Skip to content

Commit

Permalink
fix(excel): Add #EMPTY value to save correctly the model as dict.
Browse files Browse the repository at this point in the history
  • Loading branch information
vinci1it2000 committed Mar 22, 2024
1 parent bc677a3 commit 4eaa76e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion formulas/excel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,11 @@ def to_dict(self):
}
nodes = {
k: isinstance(v, str) and v.startswith('=') and '="%s"' % v or v
for k, v in nodes.items() if v != [[sh.EMPTY]]
for k, v in nodes.items()
}
nodes = {
k: '#EMPTY' if v == [[sh.EMPTY]] else v
for k, v in nodes.items()
}
for d in self.dsp.function_nodes.values():
fun = d['function']
Expand All @@ -465,6 +469,8 @@ def to_dict(self):
def from_dict(self, adict, context=None, assemble=True, ref=True):
refs, cells, nodes, get = {}, {}, set(), sh.get_nested_dicts
for k, v in adict.items():
if isinstance(v, str) and v.upper() == '#EMPTY':
v = [[sh.EMPTY]]
try:
cell = Cell(k, v, context=context, replace_missing_ref=ref)
except ValueError:
Expand Down

0 comments on commit 4eaa76e

Please sign in to comment.