Skip to content

Commit

Permalink
Fix #46 while we are at it
Browse files Browse the repository at this point in the history
  • Loading branch information
willu47 committed Jun 15, 2020
1 parent 1d840e6 commit 70ec08f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/otoole/cli.py
Expand Up @@ -158,15 +158,23 @@ def conversion_matrix(args):
raise NotImplementedError(msg)

elif args.from_format == "excel":

if args.to_format == "csv":
generate_csv_from_excel(args.from_path, args.to_path)

elif args.to_format == "datafile":

with TemporaryDirectory() as temp_folder:
generate_csv_from_excel(args.from_path, temp_folder)
csv_to_datapackage(temp_folder)
from_path = os.path.join(temp_folder, "datapackage.json")
convert_datapackage_to_datafile(from_path, args.to_path)

elif args.to_format == "datapackage":
with TemporaryDirectory() as temp_folder:
generate_csv_from_excel(args.from_path, temp_folder)
csv_to_datapackage(temp_folder)

else:
raise NotImplementedError(msg)

Expand Down
2 changes: 1 addition & 1 deletion src/otoole/preprocess/excel_to_osemosys.py
Expand Up @@ -228,7 +228,7 @@ def read_config(path_to_user_config: str = None) -> Dict:


def generate_csv_from_excel(input_workbook, output_folder):
"""Generate a folder of CSV files from a spreadsheet
"""Generate a folder of narrow, well formatted CSV files from a spreadsheet
Arguments
---------
Expand Down

0 comments on commit 70ec08f

Please sign in to comment.