Ask Your Question

PSSe Results to Excel: Results to different Column

asked 2018-03-08 09:52:33 -0500

PSSE_ABCD gravatar image

updated 2018-03-08 09:53:16 -0500

Hi All

I have written a script that automates 25 of psse cases for load flow analysis, which then exports my results into an excel sheet. This is done via a standard loop i.e. i =1 to 25. However when I run the script: the circuit MW flow vector from my previous case (i=1) is overwritten by the second case (i=2) as it in inputting it into the same EXCEL column within my script. Is there a way to export each case (i=1 to 25) MW flow into the next available column? I could use the “a”, “b” function:


x1.set_range(2,”b”,zip(*MWflowCase 2);

...... ......

However this is tedious! Ideally I want to link it to my loop of i=1 to 25; so that it can be i=1 for case 1 for column A, i=2 for Case 2 for column B, i=3 for case 3 for column C etc. Thus it would look like:

                   Column A        Column B         Column C           Column D
      Circuit    Case 1 (i=1)      Case 2 (i=2)     Case 3 (i=3)    Case 4 (i=4)
          1           100                200            300               400
          2          250                 300            100               700
          3           50                 100             75               25

Can anyone help or give guidance?

Thanks in Advance

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2018-03-09 00:16:24 -0500

perolofl gravatar image

It seems like you are using excelpy. You can use column number instead of column letter so loop variable i can be used directly. I.e.


The line circuit number is written in the first column in your example. First column is number 1 so first case should be written in the second column. Hence, use i+1 in the code above.

edit flag offensive delete link more

answered 2018-03-08 20:45:27 -0500

jconto gravatar image

a CSV file solution:

In python, create a list of lists (a 2D array!) where each row contains data output from each case, and it is appended to the 2D array. Once the 25 cases are processed, save the transpose of the 2D array as a CSV file. Open Excel and load the CSV file. done.

edit flag offensive delete link more


Hi Thanks for the words of wisdom, any idea on how the code is suppose to look like? I have never used 2D arrays, so I have no idea where to start. Thanks again.

PSSE_ABCD gravatar imagePSSE_ABCD ( 2018-03-08 21:54:01 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower


Asked: 2018-03-08 09:52:33 -0500

Seen: 463 times

Last updated: Mar 09 '18