Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I've had success exporting ACCC results to Excel in a loop, but I tend to put them in different sheets within the one file. Here is some of my code:

import pssexcel

THISFOLDER = os.path.abspath(os.path.dirname(sys.argv[0])) # You may need to change this line with your folder location.
# Look through all files in the directory looking for the right extension
accfiles = []
for f in os.listdir(THISFOLDER):
    if f.lower().endswith(".acc"):
        accfiles.append(f)

total_files = len(accfiles)
count = 0
for accfile in accfiles:
    count = count + 1
    print "Processing ACCC file", count, "of", total_files
    print "File =", accfile
    xlsfile = "ACCC_Results.xls"
    sheet = accfile[:-4]
    print "SHEET =", sheet
    pssexcel.accc(THISFOLDER + "\\" + accfile, ['s','e','b'], colabel='', stype='contingency',busmsm=0.5, sysmsm=5.0, rating='a', namesplit=True, xlsfile=xlsfile,sheet=sheet, overwritesheet=True, show=True, ratecon='c',baseflowvio=False, basevoltvio=False, flowlimit=90.0, flowchange=0.0,voltchange=0.0)
print "Script finished."