import openpyxl
import getpass
import os
import shutil
import sys
from openpyxl.utils import get_column_letter
from openpyxl.styles import Border, Side, NamedStyle, Color, PatternFill, Font, Alignment
from openpyxl.styles import colors
from openpyxl import Workbook
import win32com.client as win32
import xlwings as xw
REMOVE: All counters that are no longer being used. Check on raw_input, row deletion, and pandas.
curr_row = 2
detections = 0
detections_rem_tmfrm = 0
pias_needed = 0
pias_comp = 0
web_num = "Null"
int_end_analysis = 0
int_ptch_analysis = 0
print(e)
op = input('\nDo you want to continue? Y/N\n\n').upper()
if op != "Y":
sys.exit("\nExiting program.")
else:
print("\nContinuing process.")
#get user name
dirpath = os.getcwd()
print("current directory is : " + dirpath)
foldername = os.path.basename(dirpath)
print("Directory name is : " + foldername)
#get current directory
#os.chdir(foldername % username)
#os.path.join(foldername,username)
#Loads Excel sheet with all of the companies' responses recorded.
data_file = openpyxl.load_workbook('_Dash_Da.xlsx')
for row in range (2, q1_sheet.max_row+1):
Gets value of cell in Column A, Row[whatever int the variable "row" is currently representing] curr_opco = q1_sheet['B' + str(row)].value
shutil.copy("_Dash_tem.xlsx", "%s Dash.xlsx" % curr_opco)
print("\nCreated Oco Dash Tem")
col_num_left = 6
col_num_right = 13
for quarter in quarters_arr:
#Keep a placeholder number for the column where this all gets written.
#This will deprecate through the loop
print("\n.......Beginning work on %s...\n" % quarter)
#Iterate through each Op
for row in range (2, 20):
print("Current Op: " + curr_op)
#Gets value of cell in Column A, Row[whatever int the variable "row" is currently representing]
curr_op = quarter['B' + str(row)].value
#print(quarter)
#print(curr_op)
qtr_title = quarter.title
#Load current Op's template file
dashboard = openpyxl.load_workbook('%s Das.xlsx' % curr_op)
exec_summary = dashboard.worksheets[0]
endpt_details = dashboard.worksheets[1]
patching_details = dashboard.worksheets[2]
privacy_details = dashboard.worksheets[3]
cloudmon_details = dashboard.worksheets[4]
critasset_details = dashboard.worksheets[5]
#Add any new worksheet up here
#Collect End sey de
ser_sc_A = quarter['E' + str(row)].value
cl_sc_A = quarter['F' + str(row)].value
dev_A_co = quarter['G' + str(row)].value
ser_sc_S = quarter['I' + str(row)].value
c_s_S = quarter['J' + str(row)].value
ds_S_in = quarter['K' + str(row)].value
IN this line of code i am getting error('>' not supported between instances of 'str' and 'int') here i am trying to do some calulation and write it to excel file but here i am getting error
AVd = (quarter['E' + str(row)].value +quarter['F' + str(row)].value)
if AVd > 0:
AVvalue = (dev_A_co/ AVd)*100
elif AVd==0:
AVvalue = 100
#Get current column letters:
left_col_ltr = (get_column_letter(co
l_num_left))
right_col_ltr = (get_column_letter(col_num_right))
dashboard.save('%s Dash.xlsx' % curr_op)
AV is not defined and it is being used in if loop. Print output of variable and types to check further.