I have a large simulation and I would like to save my results in an excel file.

I have a main class and a class where there are the results, and I ama able to print them, but I can't save them in a file.
How can I do it? Where do I have to put the parts here...? I can create a file with only the last parameters printed now...