Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Programmatic Spreadsheet Access
This worksheet demonstrates some of the features of the Spread package. This package is intended to provide support for accessing Maple spreadsheets programmatically. As you read this worksheet, you should execute the commands in sequence as you come to them.
Accessing the Spread Package
To use the Spread package, you must first issue the following call to the procedure with, which provides interactive access to procedures organized into packages.
The routines exported by the Spread package are now available for interactive use. The procedures available in the package are displayed as the result of the with command.
Creating Spreadsheets
The first task with which you must become acquainted is the programmatic creation of spreadsheets. When a spreadsheet is created, it is given a name. The procedure CreateSpreadsheet is provided for programmatic control of spreadsheet creation. The name of the spreadsheet is returned. You must use this name to refer to the spreadsheet in subsequent calls to Spread package procedures.
Now, the variable ssid is assigned the name of the spreadsheet that was created by executing the preceding command.
When no argument are provided, CreateSpreadsheet returns a system-generated name for the spreadsheet. You can also specify your own name for the spreadsheet by providing that name as an argument to the call to CreateSpreadsheet. If you create a spreadsheet by using the Insert, Spreadsheet menu item, you can determine its name by opening the Properties dialog box that is accessible from the context-sensitive menu for the spreadsheet.
Selecting Cells
Every spreadsheet has, at all times, a "current selection". This refers to the box-shaped region of cells that are visually distinguished from those that do not belong to the selection. Many of the Spread package procedures operate on and allow you to manipulate the current spreadsheet selection.
Try changing the selected region before executing the following command. You can re-execute this command after selecting different cells with the mouse.
This command will copy the selection from the spreadsheet above to the spreadsheet MySpreadsheet that was created earlier.
Evaluating Cells and Manipulating Cell Data
You can evaluate either an entire spreadsheet, or just the current selection (which you can set using the procedure SetSelection), by using the commands EvaluateSpreadsheet and EvaluateCurrentSelection, respectively.
The command GetCellValue will retrieve the (displayed) value from a specified cell. The formula stored in a given cell can be queried by using the command GetCellFormula. By using SetCellFormula, you can set the formula of a cell (but not the cell value).
Performing Block Operations with Matrix Data
Sometimes it is convenient to manipulate entire blocks of data within a spreadsheet. Such blocks can be represented in Maple using matrices. Certain commands in the Spread package allow you to manipulate spreadsheet data in a blockwise fashion, using matrices.
The Procedure SetMatrix inserts a matrix of values into a spreadsheet. Blocks of data can be extracted from a spreadsheet by using the commands GetValuesMatrix and GetFormulaeMatrix. You can import matrix data into a spreadsheet selection, with clipping, by using the command InsertMatrixIntoSelection.
Return to Index for Example Worksheets
Download Help Document