-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtableCompiling.py
49 lines (38 loc) · 1.7 KB
/
tableCompiling.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
# programma per leggere su un excel e poi fare una query sullo stesso e scriverlo su un nuovo foglio excel
# parametricData costruzione del file excel dal word specifico del PLC di nostro interesse
# pip3 install pandas openpyxl
import sys
import utilsLib
import excelFunction as ex
# Default variable
outPath = "CompileTable_gen.xlsx"
def help():
print("Error argv, argument passed was:")
print(sys.argv)
print("Correct usage:\n\ttableCompiling.py <IOExcel.xls path> <parametricExcel.xls path> [out.xls path]")
print("To install dependence: \n pip3 install pandas openpyxl")
exit(-1)
if __name__ == '__main__':
# Input Read
if (len(sys.argv) < 3):
help()
IOexcelPath = sys.argv[1]
ParExcelPath = sys.argv[2]
if (len(sys.argv) >= 4):
outPath = sys.argv[3]
# Sheet Data Load
ex.sheetLoadIO(IOexcelPath)
ex.sheetLoadParamExcel(ParExcelPath)
##################################
# Table Generation and Save Zone #
##################################
with ex.pd.ExcelWriter(outPath, mode='w') as writer:
# TrunkData-gen Sheet Generate and Save
ex.trunkTableGen().to_excel(writer, index=False, header=True, sheet_name='TrunkData-gen')
# DigIn-TrunkPCT Sheet Generate and Save
ex.digIn_PctTrunkRegion().to_excel(writer, index=False, header=True, sheet_name='DigIn-TrunkPCT')
# DigIn-ConvInput Sheet Generate and Save
ex.DigIn_ConvInput_Region().to_excel(writer, index=False, header=True, sheet_name='DigIn-ConvInput')
# DigIn-ConvInput Sheet Generate and Save
ex.DIGOut_LightOut_Region().to_excel(writer, index=False, header=True, sheet_name='DigOut-LightOutput')