Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi Jervis!, Thank you very much for your answer. Unfortunately the script don't send any data to the Workbook. Python continuous still hard to me and I guess I made a fool mistake but "hello 5!" doesn't appear nowhere :(

# Read ...
ierr, buses = psspy.abusint(-1,2,string='NUMBER')
ierr, iarea = psspy.abusint(-1,2, string='AREA')
ierr, volts = psspy.abusreal(-1,2,string='PU')
# Open and Show excel
x1 = excelpy.workbook()
x1.show()
# Write Titel on Excel
x1.set_cell('a1', 'AREA')
x1.set_cell('b1', 'Bus Number')
x1.set_cell('c1', 'Voltage [pu]')
# Transpose the columns into rows 
rows = zip(buses, iarea, volts)
# Send data to Excel
for rowid, record in enumerate(rows):
    bus, area, voltage = record    
    print 'hello all!'
    if area == 5:
        print 'hello 5!'
        x1.set_range(2 + rowid, 'a', area)
        x1.set_range(2 + rowid, 'b', bus)
        x1.set_range(2 + rowid, 'c', voltage)
# Save Workbook
x1.save('demo.xlsx')