aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-04-30 07:49:14 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-04-30 07:49:14 +0200
commit054019f7afb7aeeac680493c0b176eb35a832c96 (patch)
tree0b5693d15e917cd97461daa29c02896f4dbfa7fd /src/ee/tools
parent37e4be24129b6980e3e9fced7345d4a596af3d58 (diff)
downloadee-python-054019f7afb7aeeac680493c0b176eb35a832c96.tar.gz
ee-python-054019f7afb7aeeac680493c0b176eb35a832c96.tar.bz2
ee-python-054019f7afb7aeeac680493c0b176eb35a832c96.tar.xz
ee-python-054019f7afb7aeeac680493c0b176eb35a832c96.zip
part:
o Experimental importer from Excel-like files.
Diffstat (limited to 'src/ee/tools')
-rw-r--r--src/ee/tools/part_from_excel.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ee/tools/part_from_excel.py b/src/ee/tools/part_from_excel.py
new file mode 100644
index 0000000..63c7b65
--- /dev/null
+++ b/src/ee/tools/part_from_excel.py
@@ -0,0 +1,27 @@
+import argparse
+from pathlib import Path
+
+from ee.part import save_db
+from ee.part.excel import from_excel
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument("--in",
+ dest="in_path",
+ required=True,
+ metavar="EXCEL")
+
+parser.add_argument("--out",
+ dest="out_path",
+ required=True,
+ metavar="PART DB")
+
+parser.add_argument("--sheet",
+ metavar="NAME")
+
+args = parser.parse_args()
+
+out_path = Path(args.out_path)
+part_db = from_excel(Path(args.in_path), args.sheet)
+print("len={}".format(part_db.size()))
+save_db(out_path, part_db)