-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmajorFixmo2.py
31 lines (31 loc) · 1.11 KB
/
majorFixmo2.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
import xlrd
import sys
file_name =input("Enter the name of Excel sheet no need for extension: ")
file_location = "C:/Users/Jeffrey/Desktop/"+file_name+".xlsx"
work_book = xlrd.open_workbook(file_location)
sheet = work_book.sheet_by_index(1)
formated = input("Enter the destination name no need for extension(doesn't need to exist): ")
file = open("c:/Users/Jeffrey/Desktop/"+formated+".txt","w")
number_of_students = sheet.nrows
for i in range(1, number_of_students):
id = sheet.cell_value(i,0)
last = sheet.cell_value(i,1)
first = sheet.cell_value(i,2)
hold = sheet.cell_value(i,3)
ccsf = sheet.cell_value(i,4)
sl = sheet.cell_value(i,5)
id.replace(" ", "")
last.replace(" ", "")
first.replace(" ", "")
sl.replace(" ", "")
if(ccsf != ""):
new_String ="\"" +id+" : "+last+", "+first+" \" <"+ccsf+">"
elif(sl !=""):
new_String ="\"" +id+" : "+last+", "+first+" <"+sl+">"
num = int((i/(number_of_students))*100)
sys.stdout.write("Write progress: %d%% \r" %num )
sys.stdout.flush()
file.write(new_String+"\n")
sys.stdout.write("write progress: 100 %")
sys.stdout.flush()
file.close()