-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyVertex.py
More file actions
56 lines (49 loc) · 1.26 KB
/
Copy pathPyVertex.py
File metadata and controls
56 lines (49 loc) · 1.26 KB
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
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 26 12:51:27 2016
@author: user11
"""
import os
import glob
import re
import xlwings as xw
import numpy as np
import pandas as pd
color_OK = (208,254,182)
color_NOK = (236,181,167)
path=os.getcwd()
path="G:/01-SUIVI PROCESSUS/GMM/Micro-Vu Vertex/Schrader/43173-820"
fcsv=glob.glob(path+"/CSV Data/*.txt")[-1] #File containing CSV
os.system("pause")
fxls=glob.glob(path+"/Layout/*.xlsx")[-1] #xlsx file layout for report
os.system("pause")
#print(fcsv,fxls)
#os.system("pause")
def file2df(fname):
"""CSV import function"""
data = pd.read_csv(fname,header=None,
sep=None,
index_col=False,)
return data
wb = xw.Workbook(fxls)
data=file2df(fcsv)
for index, row in data.iterrows():
# os.system("pause")
loc=data[0][index]
value=data[1][index]
if np.isnan(data[4][index]):
if np.isnan(data[3][index]):
color = color_OK
else:
color = color_NOK
elif np.isnan(data[6][index]):
color = color_OK
else:
color = color_NOK
#color = (255,255,255)
# print(loc,value)
xw.Range(str(loc)).value = value
xw.Range(str(loc)).color = color
wb.xl_workbook.PrintOut()
#os.system("pause")
wb.close()