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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

how to bind or embed an Exel spreadsheet in Mathcad Prime

mythos28th
4-Participant

how to bind or embed an Exel spreadsheet in Mathcad Prime

I would like to read values from an Excel spreadsheet in Prime, the same way I did in Mathcad 15.  PTC support set up a Mathcad file using the READEXCEL command.  The associated Excel file needs to be in the same folder as the Mathcad file for the data to be read.  Is there away I can bind or embed the Excel file to the Mathcad file, so I don't need a copy of the Excel file I am working with in every folder?

 

I have tried to insert an Excel component.  Due to the size of the spreadsheet, converting it to a matrix in Mathcad Prime, and reading the values is extremely cumbersome and related to how much of the table is visible.  

 

Thank you!

19 REPLIES 19

From Prime 3.0 help:

Capture.PNG

Fred,

 

Following the steps above, for the READEXCEL command allows data to be read from an Excel file located in the directory specified.  The data is not bound or saved within the Mathcad File.  So I can locate my file in one location and read from there, but once I send my Mathcad file in an email to some one else, the table values will be lost.

 

As far as directly copy and pasting the cells, I have attempted to paste the table directly and receive the spinning circle of no response and Mathcad freezes.  While my table is large, it was easily handled when copying and pasting in Mathcad 15. 

The READEXCEL function will allow you to specify the complete path--you do not have to have the files in the same folder.

 

I agree that it's better (especially when sending the Mathcad file to others) to have the actual EXCEL file in the Mathcad document.  This is possible!  From the Input/output tab

Capture.PNG

Will embed an EXCEL component in the document.  A double click in that component will open it in EXCEL, you copy your data and paste it into the component then you can define variables associated with cell ranges.  (Mathcad 15 had data tables that would allow a similar thing.)


@mythos28th wrote:

I have tried to insert an Excel component.  Due to the size of the spreadsheet, converting it to a matrix in Mathcad Prime, and reading the values is extremely cumbersome and related to how much of the table is visible.  



If  embedding the Excel component is no option for you,  you have to keep the Excel File separate. The only other option I could think of is to copy the vital parts of the excel sheet to a Mathcad matrix as explained at the end of the help which Fred posted and hide that part of the sheet in a collapsed region to keep it out of the way. But if the sheet is that huge as you say that might not be an option either.

 

mythos28th
4-Participant
(To:Werner_E)

This may be related to the other posts in the community as to why Prime does not have the same features as 15?  I was able to copy and paste the component with ease, no matter the size.  There is no reason to move on to Prime from 15, if I cannot resolve this issue.

The EXCEL component in Prime was (I believe) intended to replace the data table.  Like many other aspects of Prime it may be a good idea poorly executed.

 

I have toyed with using that feature to mitigate the truly horrible plotting capabilities.

Yes, Prime is far behind Mathcad 15 in many ways. I did not expect that to be true wrt Excel components, too, but its not really a surprise to hear that.

There is no reason to to move on (wouldn't it be rather a move back) to Prime anyway.

mythos28th
4-Participant
(To:Werner_E)

Once I insert the spreadsheet as a component, it is clear how to turn the spreadsheet into a Mathcad matrix/table that is readable.  READEXCEL does exactly that.  It makes no sense.  

The advantage to the component is that the numbers are stored in the Mathcad file, there is no need to link to an outside file.  If you send that sheet to someone it will stand alone.  If you send a sheet with a READEXCEL function and don't send the EXCEL file you might as well send a pdf.

I am unable to find the desired table value and pull out the corresponding value using the table commands, when inserting the component.  

See if this helps

Thank you for the example.  It seems like the problem might be how to bring text strings into the Mathcad table.  When I try the insert component command with my large spreadsheet that contains text, it is unable to calculate and produce a Mathcad table/matrix.  Using your simple example I changed 1 2 3 to A B C and the same error occured, "Excel is busy, cannot calculate variable."  But the READEXCEL command has no problem bringing the text values into the table/matrix.

Didn't seem to be a problem for me

There seems to be a calculation error or problem that occurs during recalculation on my system.  I tried substituting your values with numbers and letters and the same error turned up.  "Excel is busy. can't calculate.  Make sure cells are not being edited in excel and try again in a few seconds."  It seems like I need to solve this error with some autocalc/security settings in excel/mathcad.  I will search for a solution in the forum too.

Guess its time to compare versions.

As far as I am aware, Fred is using Prime 3.0

Which version do you use?

maybe they introduced a bug after version 3.0

 

P.S.: I just opened Freds file with Prime 3.0 and recalculated a few times - no error.

P.P.S.: It may also have to do with the version of Excel you have installed. Mine is rather old (2010)

If the embedded EXCEL component is open in EXCEL Mathcad cannot access it and will report an error.  Be sure you close EXCEL after you declare your variables. . .

That may be the cause for the problem.

 

I just opened your sheet in Prime 4 (Excel 2016) and it recalculates without any problems.

 
mythos28th
4-Participant
(To:Werner_E)

I am using Mathcad Prime 4.0 & Excel Office Professional 2013.

 

I have contacted PTC support.  We have verified the Mathcad license and reinstalled it.  I have updated my video card driver.  Next suggest step is to reinstall Excel.  

 

Any additional recommendations?  Thanks!

If you

  • Have EXCEL closed (not open at all, and
  • You unzip and open my example sheet (above)

Do all the variables report?  Or are there red marks?

Top Tags