Excel Component

Although you can import and export Excel format data files using the READFILE function, Data Wizard, or File Input, File Output and Data Table components, using the Excel component allows you to exchange data and use Excel's functionality. You can send values in your worksheet to Excel, use Excel to manipulate them, and then send new values back to your Mathcad worksheet.

Inserting an Excel Component

To insert an Excel component into a worksheet, you must have Excel 7.0 or higher installed. When you insert the component, the Excel Setup Wizard launches to guide you through the configuration process.

On the first page of the Wizard, you can choose to insert an empty Excel workbook into your worksheet or insert a copy of an existing Excel file. You can also choose to display the workbook as an icon.

On the second page of the Wizard you can specify the number of input and output variables for the component and the corresponding cells for each. For input variables, you only need to specify the starting cell, but for output variables, you must specify the exact range of cells to send back to Mathcad. You can specify any cell on any page of the worksheet, including named ranges.

Configuring an Excel Component

Right-click on an Excel component and select Properties to set the number of input and output variables and the corresponding cells for each. There is no limit to the number of input or output variables for the Excel component, aside from the capabilities of your workstation.

Inputs tab

The Inputs tab of the Excel Properties dialog specifies which cells receive data for each input variable.

If the input is a scalar, enter the cell in which to store it. If the input is an array, enter the starting cell, and Excel recreates the array in the workbook, storing the individual elements in contiguous cells. You can specify any cell on any page of the worksheet, including named ranges.

When you change the number of inputs, entries are correspondingly added or deleted from the Starting Cell table. When you delete the inputs, the mapping for the corresponding entry in the table is deleted.

Outputs tab

The Outputs tab of the Excel Properties dialog specifies which cells are returned to Mathcad via the corresponding output variable. For example, if you want the first output to be the values in cells A1, A2, B1, and B2 you should enter A1:B2. You can also enter named cells, as well as cells on other sheets in the same book.

When mapping cells to an output variable, specify the exact cells to send back to Mathcad; noncontiguous ranges are not allowed. If you want to output a 2 × 2 array starting at cell A1, you would enter A1:B2. You can also enter named ranges.

QuickSheet

Related Topics