-
Notifications
You must be signed in to change notification settings - Fork 0
/
TemplateMaker.py
79 lines (71 loc) · 2.11 KB
/
TemplateMaker.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import openpyxl as xl
# Load decoded keycodes.
codeBook = xl.load_workbook(filename = "SortedDecoded.xlsx")
# Load Vista keycodes.
codeSheet = codeBook["Vista"]
# 874 rooms in B-F.
# Fill in keycode and room.
# Iterate through all keycodes and add B-F codes into sheet, in code order.
# 1866 rooms in VDS.
# Create template sheet.
book = xl.Workbook()
sheet = book.active
# Create header.
sheet["A1"] = "Keycode"
sheet["B1"] = "Room"
sheet["C1"] = "# Sparky"
sheet["D1"] = "# Room"
sheet["E1"] = "# Mail"
sheet["F1"] = "# Fob"
currentRow = 1
prevCode = 1
while currentRow <= 874:
for codeNum in range(prevCode, 1867):
room = str(codeSheet["B" + str(codeNum + 1)].value)
letter = room[3]
if letter == "B" or letter == "C" or letter == "D" or letter == "E" or letter == "F":
sheet.append([codeNum, room])
currentRow += 1
# Use this to reduce amount of data searching.
prevCode = codeNum + 1
break
book.save("Template0-3.xlsx")
# 992 rooms in G-K.
book = xl.Workbook()
sheet = book.active
# Create header.
sheet["A1"] = "Keycode"
sheet["B1"] = "Room"
sheet["C1"] = "# Sparky"
sheet["D1"] = "# Room"
sheet["E1"] = "# Mail"
sheet["F1"] = "# Fob"
currentRow = 1
prevCode = 1
while currentRow <= 992:
for codeNum in range(prevCode, 1867):
room = str(codeSheet["B" + str(codeNum + 1)].value)
letter = room[3]
if letter == "G" or letter == "H" or letter == "I" or letter == "J" or letter == "K":
sheet.append([codeNum, room])
currentRow += 1
# Use this to reduce amount of data searching.
prevCode = codeNum + 1
break
book.save("Template3-6.xlsx")
# 400 rooms in L.
# Can copy straight from SortedDecoded.xlsx.
codeSheet = codeBook["Villas"]
book = xl.Workbook()
sheet = book.active
# Create header.
sheet["A1"] = "Keycode"
sheet["B1"] = "Room"
sheet["C1"] = "# Sparky"
sheet["D1"] = "# Room"
sheet["E1"] = "# Mail"
sheet["F1"] = "# Fob"
for codeNum in range(1, 401):
room = str(codeSheet["B" + str(codeNum + 1)].value)
sheet.append([codeNum, room])
book.save("Template6-9.xlsx")