cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

WRITEEXCEL (Mathcad Prime 3.1)

vbukowski
2-Explorer

WRITEEXCEL (Mathcad Prime 3.1)

Hello all,

I can get Mathcad Prime to create an excel file and write output to "Sheet1" "Sheet2" or "Sheet3" by using the WRITEEXCEL function, i.e:

write:=WRITEEXCEL(out.xlsx,MatrixA,1,1,"Sheet1!A1")

write:=WRITEEXCEL(out.xlsx,MatrixB,1,1,"Sheet2!A1")

write:=WRITEEXCEL(out.xlsx,MatrixC,1,1,"Sheet3!A1")

But if I create a custom sheet name such as "output!A1" or even "Sheet4!A1" it does not work unless I first open the excel file and create a sheet with that name, afterwards I can then run the function in mathcad and it will write output to that custom named sheet. This is not an ideal solution however! Is this a know limitiation of the WRITEEXCEL() function and is there some work-around so that I dont have to go and manually create sheets in the excel file?

2 REPLIES 2
RichardJ
19-Tanzanite
(To:vbukowski)

I don't know for sure, but I expect it's a limitation of the WRITEEXCEL function. It attempts to write to whatever location you specify, but if that location does not exist it does not attempt to create it, it just fails.

Checked how the function works in Mathcad 15 now, there the error message actually states "Sheet does not exist." if you try to write to a sheet with custom name.

I guess I will have to write multiple Excel files rather than using more sheets...

Thanks anyway!

Announcements

Top Tags