Skip to main content
1-Visitor
January 12, 2011
Question

Writing to multiple sheets in Excel

  • January 12, 2011
  • 1 reply
  • 8408 views

Hi All,

I'm just settling into Mathcad 15. I use Excel a lot along with Mathcad and I need to transfer data back and forth between these two applications so the ability to work with Excel 2007 is a good thing for me. The data files I read into Mathcad are usually CSV files and have a lot of parameters. I load the CSV files into Mathcad then I use Mathcad to clean up the data and perform some manipulation. The finished product is a nested matrix containing matrices of the cleaned up parameters. Each parameter is a 2 column matrix containing time and the parameter data. The reason I use a nested matrix is that each parameter has a different timebase. The problem comes when I want to output the cleaned up data from Mathcad. The only thing I can do now is write CSV files, one for each parameter but with a lot of parameters (which is usually the case) I end up with a lot of CSV files, which is inconvenient.

I want to be able to write the cleaned up parameters back to Excel but in a single file with multiple sheets each labelled with the parameter name. I've looked through the help files and can't see anything that does this. Does anybody know how I can do this?

1 reply

1-Visitor
January 12, 2011

You can use a scripted component as it the attached worksheet.

Just changed the file path within the text box.

Mike

dabber1-VisitorAuthor
1-Visitor
January 14, 2011

Thanks for the input Mike. I can't get the script to run in my mathcad although. I've attached a JPG of the error which seems to indicate that there is something wrong with the VBScript in the component. I've gone through the script, changed the file location in the text box and looked at the Developer's reference but I can't see what is causing the error.

Regards

Doug

1-Visitor
January 14, 2011

Have you created the Excel file.

I think the file has to be created first.

Mike