Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AnyLogic – Excel output: delete spreadsheet before each simulation run?

After destroying my main agent I wrote a code ExcelFile.setCellValue(...) that puts parameters into an Excel.

My output function with excel works but only if I delete the whole workspace of each spreadsheet before every simulation run. Because I have a big number of sheets this is very exhausting. Is there a possibility to overwrite my output excel without deleting manually ever sheet after a simulation run? This would save me a ton of work.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I do it this way:

//--Clearing the file------------------
excelFileOutput.readFile();

for (int m=1;m<6;m++){ //for each sheet
    for (int i=0;i<15;i++){      //for each column  
        for (int j=2;j<50000;j++){   //for each row 
            excelFileOutput.clearCell(m,j,i);   
    }       
            
}
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading