Import - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ExcelTools

  

Import

  

import data from an Excel spreadsheet

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Import(file, sheet, cells, emptycell=value)

Parameters

file

-

(optional in Standard interface) string; the name of the Excel file from which to import data

sheet

-

(optional) string or positive integer; the name or index of the sheet from which to import data (default: 1)

cells

-

(optional) string; the cell range to import (default: the entire sheet)

value

-

(optional) anything; the value given to blank cells in the spreadsheet (default is 0.0)

Options

• 

labeltype : one of symbol or string

  

When output=DataFrame, this option specifies whether non-numeric row and column labels should be expressed as symbols or strings when constructing the DataFrame.

  

The default is symbol.

• 

output : one of Matrix or DataFrame

  

This option specifies the desired method for representing the imported data in Maple.

  

The default is Matrix.

Description

• 

The Import(file,sheet,cells) function imports the data from the Microsoft Excel workbook file, as addressed by the sheet and cells parameter, into a Matrix.

• 

Both the XLSX (Office Open XML) and XLS (Excel 97-2003) file formats are supported.

• 

In the Standard interface, if the file parameter is not provided, a dialog will be presented with a field for the target file name.  In all other interfaces, the file parameter is required.

• 

The sheet parameter can be either the name of a sheet within the file or a 1-based index.

• 

The cells parameter can be a standard cell range, for example, "A1:B9" or "c$10..$w15", or a named range.  If it is given as a named range, that name must already exist in the Excel file.

• 

If cells is given as a single cell address, for example "D13", this is taken as the top-left corner of the required range, with the bottom-right corner taken to be the bottom-right corner of the sheet. (To import just a single cell, specify it as a range, for example "AQ3:AQ3".)

• 

Spreadsheets can contain empty cells in the midst of other data.  By default these cells are given the value 0.0 upon import.  Use the emptycell option to specify a different value.  For example, emptycell=undefined, or emptycell="".

Examples

To perform the following examples, you should create an Excel spreadsheet named Employees.xlsx with the necessary sheets and cells.

withExcelTools:

QImportEmployees.xlsx,Payroll,B2:C9:

Indexing only the upper left corner brings in all the rest of the sheet

RImportEmployees.xlsx,Payroll,B2:

ArrayDimsR

1..12,1..10

(1)

A cell range can be specified via a name

PImportEmployees.xlsx,FirstQuarter:

Sheets can be indexed as well as named

SImportEmployees.xlsx,2,A1:w25:

Import all of the first (or only) sheet

TImportEmployees.xlsx:

(Standard interface only) Open a dialog to enter the file name and other data

TImport

Compatibility

• 

The ExcelTools[Import] command was updated in Maple 2023.

• 

The labeltype and output options were introduced in Maple 2023.

• 

For more information on Maple 2023 changes, see Updates in Maple 2023.

See Also

Array

ExcelTools

ExcelTools[Export]

ExcelTools[WorkbookData]