Spaces:
Sleeping
Sleeping
Update SchedBuilderUtyModule.py
Browse files- SchedBuilderUtyModule.py +13 -7
SchedBuilderUtyModule.py
CHANGED
@@ -4,6 +4,7 @@ import pandas as pd
|
|
4 |
import numpy as np
|
5 |
import sqlite3
|
6 |
import functools
|
|
|
7 |
|
8 |
|
9 |
def debug(func):
|
@@ -372,7 +373,7 @@ def getEEinfo(FtBook,TempBook): #Need to make volunteer shift data puller
|
|
372 |
|
373 |
return a,c
|
374 |
|
375 |
-
def addRecs(flNm,shNm,tblNm,data):
|
376 |
"""Adds data to existing excel table in new rows. Used to flesh out tables in visual template (blank tables)"""
|
377 |
wb=pyxl.load_workbook(flNm)
|
378 |
ws=wb[shNm]
|
@@ -386,9 +387,11 @@ def addRecs(flNm,shNm,tblNm,data):
|
|
386 |
newT=pyxl.worksheet.table.Table(displayName=t.displayName,ref=t.ref[:-len(str(row))]+str(row+len(records)))
|
387 |
style = pyxl.worksheet.table.TableStyleInfo(name="TableStyleLight1",showRowStripes=True)
|
388 |
newT.tableStyleInfo = style
|
389 |
-
del ws.tables[tblNm]
|
390 |
-
ws.add_table(newT)
|
391 |
-
|
|
|
|
|
392 |
|
393 |
def translate_Visual_Template(flNm,ftRef=None,tRef=None):
|
394 |
"""Takes in an assignment list file, and composes the All_Slots table and Assignment_List table by reading the Visual Template"""
|
@@ -439,6 +442,9 @@ def translate_Visual_Template(flNm,ftRef=None,tRef=None):
|
|
439 |
data.append([1,tp,cl-1,got[-1][1]-1,eeDict[nm].eeID,jbNms[rw]])
|
440 |
except KeyError:
|
441 |
print('The name '+nm+' identified in the visual template could not be associated with EE data from the refusal sheets. Check the formatting')
|
442 |
-
|
443 |
-
|
444 |
-
|
|
|
|
|
|
|
|
4 |
import numpy as np
|
5 |
import sqlite3
|
6 |
import functools
|
7 |
+
from copy import deepcopy
|
8 |
|
9 |
|
10 |
def debug(func):
|
|
|
373 |
|
374 |
return a,c
|
375 |
|
376 |
+
def addRecs(flNm,shNm,tblNm,data,otptNm='AutoPrimed_Template.xlsx'):
|
377 |
"""Adds data to existing excel table in new rows. Used to flesh out tables in visual template (blank tables)"""
|
378 |
wb=pyxl.load_workbook(flNm)
|
379 |
ws=wb[shNm]
|
|
|
387 |
newT=pyxl.worksheet.table.Table(displayName=t.displayName,ref=t.ref[:-len(str(row))]+str(row+len(records)))
|
388 |
style = pyxl.worksheet.table.TableStyleInfo(name="TableStyleLight1",showRowStripes=True)
|
389 |
newT.tableStyleInfo = style
|
390 |
+
# del ws.tables[tblNm]
|
391 |
+
# ws.add_table(newT)
|
392 |
+
ws.tables[tblNm]=newT
|
393 |
+
wb.save(filename=otptNm)
|
394 |
+
|
395 |
|
396 |
def translate_Visual_Template(flNm,ftRef=None,tRef=None):
|
397 |
"""Takes in an assignment list file, and composes the All_Slots table and Assignment_List table by reading the Visual Template"""
|
|
|
442 |
data.append([1,tp,cl-1,got[-1][1]-1,eeDict[nm].eeID,jbNms[rw]])
|
443 |
except KeyError:
|
444 |
print('The name '+nm+' identified in the visual template could not be associated with EE data from the refusal sheets. Check the formatting')
|
445 |
+
#Note that, at this time, the output file already exists with previously added rows in first table. therefore refer to this file as the file to write to, in following command.
|
446 |
+
addRecs('AutoPrimed_Template.xlsx','Assignment_List','Assn_List',data)
|
447 |
+
# wb.save('wow.xlsx')
|
448 |
+
# new=deepcopy(wb)
|
449 |
+
# new.save('AutoPrimed_Template.xlsx')
|
450 |
+
return 'AutoPrimed_Template.xlsx'
|