Skip to main content
1-Visitor
October 20, 2010
Solved

How to read sheet 2 or higher of Excel file from within Mathcad

  • October 20, 2010
  • 1 reply
  • 3300 views

1) Can someone tells me how can we read "sheet2" or higher of an excel file directly from mathcad.

For example, I can read an excel file with a commad like READFILE("c:\myfile.xls","excel") but I am getting the sheet1 only.

What should I do to be able to read sheet2 or higher from myfile.xls

2) Yesterday I put a question and I received a correct answer. I cannot find how to set that the question has been correctly answered !

Sorry but I rarely use the PTC community discussion forum

Thank you

Best answer by MikeArmstrong

The attached scripted component does exactly what you want.

Change the file path to suit your file name - make sure its exactly as your file including the Excel version. Right click the text box click edit script and select the tick at the top. The data should then be extracted as per "Pages" at the top of the sheet.

2) Yesterday I put a question and I received a correct answer. I cannot find how to set that the question has been correctly answered !

Sorry but I rarely use the PTC community discussion forum

I think you select the post where the answer and the site gives you a option to state that the post is the answer.

Mike

1 reply

1-Visitor
October 20, 2010

The attached scripted component does exactly what you want.

Change the file path to suit your file name - make sure its exactly as your file including the Excel version. Right click the text box click edit script and select the tick at the top. The data should then be extracted as per "Pages" at the top of the sheet.

2) Yesterday I put a question and I received a correct answer. I cannot find how to set that the question has been correctly answered !

Sorry but I rarely use the PTC community discussion forum

I think you select the post where the answer and the site gives you a option to state that the post is the answer.

Mike

Youki1-VisitorAuthor
1-Visitor
November 12, 2010

Dear all,

The answer below runs well and I can read several sheet from an Excel file.

I am always gettign the security warning asking if I want to disable the evaluation or not.

It is clear that I can answer by hand and have the script running correctly.

The security setting bring me some issues when i am inserting the script in another mathcad file.

I don't know how to remove this security alarm.

Thank you

patrice

19-Tanzanite
November 12, 2010

Go to "tools", "preferences", and set the script security to low.