Ask Your Question

Dyntools Overwrite Excel Sheet

asked 2018-03-21 19:44:01 -0500

camerond12 gravatar image


I am using dyntools to output data to excel.

dyntools.CHNF.xlsout(xlsresult, channels=[], show=False, xlsfile=xlsoutput, outfile=outfile, overwritesheet = True)

This is the code I am using, I believe that overwritesheet = True should overwite sheet1 every time I run the script.

I currently need to delete the old excel sheet every time I re run my script or else the excel workbook will create new sheets of the same data, which causes the file to become huge.

What should I do?


edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted

answered 2018-08-17 13:57:12 -0500

Juan gravatar image

I have the following problem Dyntools does not extract data from file out


Output completed Traceback (most recent call last): File "C:\0-C\0-Simulaciones\Caso\Simulació", line 227, in <module> datosexcel = dyntools.CHNF(archivoout + '.out') File ".\", line 1023, in init File ".\", line 351, in outextractdata File ".\", line 321, in outextractid

Couldn't open Python file: C:\0-C\0-Simulaciones\Caso\Simulació

edit flag offensive delete link more


check my post at "Multi-Threading using xlsout"

jconto gravatar imagejconto ( 2018-08-17 17:58:09 -0500 )edit

HI, Thanks

Juan gravatar imageJuan ( 2018-08-21 09:08:04 -0500 )edit

Hello, I don't know how to solve this problem, but my opinion is that you should never use orthographic accent in Python even in comments or files names.

SAE_2016 gravatar imageSAE_2016 ( 2018-09-07 09:14:55 -0500 )edit

answered 2018-03-28 19:42:35 -0500

haveityourwa gravatar image

if you also have lots of sheets you could delete a folder and remake it instead of each sheet,

if os.path.exists(PathDir + r"\sheets"):
    shutil.rmtree(PathDir + r"\sheets")
    os.makedirs(PathDir + r"\sheets")

Tried this as a comment but no formatting was available. Sorry if you got spammed with notifications of me changing the comment a bunch

edit flag offensive delete link more

answered 2018-03-22 02:20:05 -0500

camerond12 gravatar image

I think that this overwritesheet = true option will overwrite latest sheet if it is called more than once during simulation.

In my case, I am re running the script rather than using the dyntools command more than once in the same script.

To overcome this, I check for and delete existing excel file in directory by adding the following code just before using dyntools.CHNF.xlsout(..)

if os.path.exists(xlsoutput):
   except WindowsError:
      print 'file is open'
edit flag offensive delete link more

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


Asked: 2018-03-21 19:44:01 -0500

Seen: 154 times

Last updated: Aug 17 '18