-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenxl1.py
150 lines (140 loc) · 4.9 KB
/
openxl1.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
from openpyxl import Workbook, load_workbook
from dbfread import DBF
wb = Workbook()
table = DBF("DBRADON.DBF", load = True, ignore_missing_memofile=True)
length = len(table)
ws1 = wb.create_sheet("RFD", 0)
ws2 = wb.create_sheet("RAC")
ws1['A1'] = "Date"
ws1['E1'] = "Measurement Start"
ws1['F1'] = "Measurement End"
ws1['G1'] = "Exposition Length"
ws1['H1'] = "Measurement Length"
ws1['I1'] = "Radon activity"
ws1['J1'] = "Radon activity +-"
ws1['K1'] = "RFD"
ws1['L1'] = "RFD+-"
ws1['O1'] = "SK-13"
ws2['A1'] = "Date"
ws2['E1'] = "Measurement Length"
ws2['F1'] = "Radon activity"
ws2['G1'] = "Radon activity +-"
ws2['H1'] = "RAC"
ws2['I1'] = "RAC+-"
ws2['J1'] = "Volume, l"
ws2['L1'] = "SK-13"
# Imports RFD measurement time data************************************
c = 1 # counter for loop
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
timeb = str(table.records[i]['DTEXP'])
ws1['A' + str(c)].value = timeb
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
timeb = str(table.records[i]['BGEXP']) + ' ' + str(table.records[i]['BGTM']) + ':' + str(table.records[i]['BGTM2'])
ws1['E' + str(c)].value = timeb
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
timee = str(table.records[i]['EDEXP']) + ' ' + str(table.records[i]['EDTM']) + ':' + str(table.records[i]['EDTM2'])
ws1['F' + str(c)].value = timee
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
ws1['G' + str(c)].value = table.records[i]['TEXP']
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
ws1['H' + str(c)].value = table.records[i]['TL']
print("Importation of RFD time data complete")
# Imports RFD radon activity************************************
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
ws1['I' + str(c)].value = table.records[i]['A214BI']
# Imports radon activity measurement error
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
ws1['J' + str(c)].value = table.records[i]['D214BI']
print("Importation of RFD radon activity data complete")
# Imports rfd**************************************************
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
ws1['K' + str(c)].value = table.records[i]['A_RN1']
# Imports rfd measurement error
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
ws1['L' + str(c)].value = table.records[i]['D_RN1']
print("Importation of radon flux data complete")
# Imports RFD SK13 values***********************************************
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 30:
c = c + 1
ws1['O' + str(c)].value = table.records[i]["MEASURE"]
print("Importation of RFD SK13 data complete")
# Imports RAC time values*********************************************
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 60:
c = c + 1
timeb = str(table.records[i]['DTEXP'])
ws2['A' + str(c)].value = timeb
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 60:
c = c + 1
ws2['E' + str(c)].value = table.records[i]['TL']
print("Importation of RAC time data complete")
# Imports RAC radon charcoal activity************************************
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 60:
c = c + 1
ws2['F' + str(c)].value = table.records[i]['A214BI']
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 60:
c = c + 1
ws2['G' + str(c)].value = table.records[i]['D214BI']
print("Importation of RFD radon activity data complete")
# Imports RAC values**************************************************
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 60:
c = c + 1
ws2['H' + str(c)].value = table.records[i]['A_RN1']
# Imports RAC measurement error
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 60:
c = c + 1
ws2['I' + str(c)].value = table.records[i]['D_RN1']
c = 1
# Imports RAC measurement volume
for i in range(length):
if table.records[i]['TYPE'] == 60:
c = c + 1
ws2['J' + str(c)].value = table.records[i]['VPR']
print("Importation of RAC data complete")
# Imports RAC SK13 values***********************************************
c = 1
for i in range(length):
if table.records[i]['TYPE'] == 60:
c = c + 1
ws2['L' + str(c)].value = table.records[i]["MEASURE"]
print("Importation of RAC SK13 data complete")
wb.save("radon autodata.xlsx")