Skip to content

Commit

Permalink
ENH: ODS support added
Browse files Browse the repository at this point in the history
  • Loading branch information
dhirajeadara4gramener authored and janezd committed Dec 12, 2018
1 parent adc5286 commit de8084a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 4 additions & 5 deletions Orange/data/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from importlib import import_module
from itertools import chain, repeat
from math import isnan
# from pyexcel_ods import save_data as ods_write
from pyexcel_ods import save_data as ods_write

from os import path, remove
from tempfile import NamedTemporaryFile
Expand Down Expand Up @@ -1037,10 +1037,9 @@ def write_file(cls, filename, data):
sheet.write(i+1, j, fmt(v))
j += 1
workbook.save(filename)
# elif filename.endswith(".ods"):
# ods_formatted_data = [[float(fmt(v)) for fmt, v in zip(formatters, flatten(row))] for row in zipped_list_data]
# print(ods_formatted_data)
# ods_write(filename, {"Sheet1": ods_formatted_data})
elif filename.endswith(".ods"):
ods_formatted_data = [[str(fmt(v)) for fmt, v in zip(formatters, flatten(row))] for row in zipped_list_data]
ods_write(filename, {"Sheet1": [headers] + ods_formatted_data})


class DotReader(FileFormat):
Expand Down
4 changes: 3 additions & 1 deletion requirements-core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ bottleneck>=1.0.0
# Reading Excel files
xlrd>=0.9.2
# Writing Excel Files
xlwt>=
xlwt>=1.3.0
# Writing ods files
pyexcel-ods>=0.5.3
# Encoding detection
chardet>=3.0.2
# Multiprocessing abstraction
Expand Down

0 comments on commit de8084a

Please sign in to comment.