Skip to content
Snippets Groups Projects
Commit 92644ba4 authored by I. Nüske's avatar I. Nüske
Browse files

BUG: convert.XLSXConverter._validate_and_convert now parses booleans that were...

BUG: convert.XLSXConverter._validate_and_convert now parses booleans that were retrieved as integer or a formula
parent 3cb23ce9
No related branches found
No related tags found
2 merge requests!128MNT: Added a warning when column metadata is not configured, and a better...,!123Parse binary or formula boolean values
......@@ -478,6 +478,12 @@ class XLSXConverter:
if isinstance(value, datetime.date) and (
{'type': 'string', 'format': 'date'} in subschema["anyOf"]):
return value
# booleans might be retrieved as an integer or formula
if subschema.get('type') == 'boolean':
if value == 0 or isinstance(value, str) and 'false' in value.lower():
value = False
if value == 1 or isinstance(value, str) and 'true' in value.lower():
value = True
jsonschema.validate(value, subschema)
# Finally: convert to target type
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment