Skip to content

Commit c9d531d

Browse files
authored
Merge pull request #37 from mleiseca/currency_fix
Fixing #36
2 parents c870ddf + 2ea121f commit c9d531d

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

changelog.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: pyexcel-ods3
22
organisation: pyexcel
33
releases:
4+
- changes:
5+
- action: added
6+
details:
7+
- '`#36`: fixing get_data for a currency cell with no currency defined'
8+
date: 10.7.2024
9+
version: 0.6.2
410
- changes:
511
- action: added
612
details:

pyexcel_ods3/odsr.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ def cell_value(self, row, column):
4343
if service.has_no_digits_in_float(cell_value):
4444
cell_value = int(cell_value)
4545

46-
ret = str(cell_value) + " " + cell.currency
46+
if cell.currency is None:
47+
ret = str(cell_value)
48+
else:
49+
ret = str(cell_value) + " " + cell.currency
4750
elif cell_type in service.ODS_FORMAT_CONVERSION:
4851
value = cell.value
4952
n_value = service.VALUE_CONVERTERS[cell_type](value)
12 KB
Binary file not shown.

tests/test_bug_fixes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,15 @@ def test_issue_30_precision_loss():
109109
sheet.save_as(test_file)
110110

111111

112+
def test_issue_36():
113+
from pyexcel_ods3 import get_data
114+
115+
test_file = "currency_without_currency.ods"
116+
data = get_data(get_fixtures(test_file))
117+
eq_(data["Sheet1"][6][0], '1.75"')
118+
eq_(data["Sheet1"][6][5], "95")
119+
eq_(data["Sheet1"][6][6], 25)
120+
121+
112122
def get_fixtures(filename):
113123
return os.path.join("tests", "fixtures", filename)

0 commit comments

Comments
 (0)