Skip to content

Commit

Permalink
Allow results to be converted to excel format
Browse files Browse the repository at this point in the history
  • Loading branch information
willu47 committed Feb 7, 2024
1 parent 2322bb6 commit 551b8bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/otoole/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def get_parser():
result_parser.add_argument(
"to_format",
help="Result data format to convert to",
choices=sorted(["csv"]),
choices=sorted(["csv", "excel"]),
)
result_parser.add_argument(
"from_path", help="Path to file or folder to convert from"
Expand Down
8 changes: 6 additions & 2 deletions src/otoole/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def convert_results(
from_format : str
Available options are 'cbc', 'cplex' and 'gurobi'
to_format : str
Available options are 'csv'
Available options are 'csv', 'excel'
from_path : str
Path to cbc, cplex or gurobi solution file
to_path : str
Expand Down Expand Up @@ -125,7 +125,11 @@ def convert_results(
write_defaults = True if write_defaults else False

if to_format == "csv":
write_strategy = WriteCsv(
write_strategy: WriteStrategy = WriteCsv(
user_config=user_config, write_defaults=write_defaults
)
elif to_format == "excel":
write_strategy = WriteExcel(
user_config=user_config, write_defaults=write_defaults
)
else:
Expand Down

0 comments on commit 551b8bf

Please sign in to comment.