Skip to content

Commit

Permalink
feat: safer check for integer in Excel
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Feb 4, 2022
1 parent 410a983 commit 738167a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

*
* Safer check for integer value in Excel

## [0.6.4] - 2021-12-18

Expand Down
3 changes: 2 additions & 1 deletion src/quorum/formats.py
Expand Up @@ -99,6 +99,7 @@ def xlsx_to_map(file_path, keys = (), types = (), ignore_header = True):
def xlsx_raw(cell_s):
is_str = cell_s.ctype == xlrd.XL_CELL_TEXT
if is_str: return cell_s.value
is_int = cell_s.value == int(cell_s.value)
try: is_int = cell_s.value == int(cell_s.value)
except ValueError: is_int = False
if is_int: return legacy.UNICODE(int(cell_s.value))
return legacy.UNICODE(cell_s.value)

0 comments on commit 738167a

Please sign in to comment.