| 1 |
"""
|
| 2 |
|
| 3 |
EvidoxEclipseLiveReports
|
| 4 |
|
| 5 |
Created by
|
| 6 |
Emanuel Borges
|
| 7 |
02.20.2018
|
| 8 |
|
| 9 |
A program that will create a live report in eclipse by copying a report that someone updates, clearing the metadata
|
| 10 |
and then copying to the live reports folder of that case. This would be a link that is already set up in the admin.
|
| 11 |
From here, it will be run by a cron that runs every hour.
|
| 12 |
|
| 13 |
Eventually this should use com to take the spreadsheet report and lock the workbook.
|
| 14 |
|
| 15 |
"""
|
| 16 |
|
| 17 |
import shutil, os
|
| 18 |
from win32com.client import Dispatch
|
| 19 |
|
| 20 |
|
| 21 |
if __name__ == '__main__':
|
| 22 |
reportMatrix = {
|
| 23 |
r"\\bluearc01\Jobs\Beck Reed Riden\SharkNinja-Keurig\20180220 - Use Custodian and Search Summary.xlsx": r"\\iadcifs01\iproshares01\BERR-SharkNinja-Keurig\Work Product\Live Reports\Use Custodian and Search Summary.xlsx",
|
| 24 |
r"L:\__People\Emanuel\MCP3_Temp\I Grace Productions-JS-LiveReport.xlsx": r"\\iadcifs01\iproshares01\LABA-I Grace Productions\Work Product\Live Reports\I Grace Productions-JS-LiveReport.xlsx",
|
| 25 |
r"L:\__People\Emanuel\MCP3_Temp\McLaughlin Northrup - McDonald Fracassa-JS-LiveReport.xlsx":r"\\iadcifs01\iproshares01\MUKI-McLaughlin Northup-McDonald\Work Product\Live Reports\McLaughlin Northrup - McDonald Fracassa-JS-LiveReport.xlsx"
|
| 26 |
}
|
| 27 |
excelFileExts = ['.xls','.xlsx']
|
| 28 |
print "Now updating live reports..."
|
| 29 |
for sourceABS in reportMatrix:
|
| 30 |
shutil.copyfile(sourceABS,reportMatrix[sourceABS])
|
| 31 |
fileExt = os.path.splitext(reportMatrix[sourceABS])[1]
|
| 32 |
if fileExt in excelFileExts:
|
| 33 |
print "This is a spreadsheet. Locking..."
|
| 34 |
xlApp = Dispatch('Excel.Application')
|
| 35 |
xlBook = xlApp.Workbooks.Open(reportMatrix[sourceABS])
|
| 36 |
sheetCount = xlBook.Sheets.Count
|
| 37 |
for i in range(sheetCount):
|
| 38 |
sht = xlBook.Worksheets(i + 1)
|
| 39 |
sht.Protect("Evidox2013")
|
| 40 |
xlBook.Protect("Evidox2013")
|
| 41 |
xlBook.Save()
|
| 42 |
xlBook.Close()
|
| 43 |
print "Spreadsheet locked sucessfully."
|
| 44 |
|
| 45 |
print "All live reports updated." |